//09.02.2008, 18.02.2008, 19.02.2008, 23.02.2008, 01.03.2008, 26.07.2008, 27.07.2008, 31.07.2008

//18.02.2008, 27.07.2008
//-------------------------------------------------------------------------------------------
function JSC_ButtAction(jsCommand)
{
	jsSubmit = true;
	
	switch (jsCommand)
	{
		case "r0":	switch (window.document.forms[0].FrmSiteId.value)
					{
						case "enma1":	
						case "enma2":	window.document.forms[0].FrmAccoPassword.value = "";
										break;
					}
					break;
		case "r3":	switch (window.document.forms[0].FrmSiteId.value)
					{
						case "enma1":	Json_Enma1RecordSave();
										jsSubmit = false;
										break;
						case "enma2":	Json_Enma2RecordSave();
										jsSubmit = false;
										break;
					}
					break;
	}
	
	if (jsSubmit == true)
	{
		window.document.forms[0].FrmCommand.value = "action";
		window.document.forms[0].FrmValue.value = jsCommand;
		document.forms[0].submit();
	}
}

//03.02.2008, 23.02.2008 ----- entfernt in dema_f.php
//-------------------------------------------------------------------------------------------
function JSC_ButtCreDev()
{
	window.document.forms[0].FrmCommand.value = "rec";
	window.document.forms[0].FrmValue.value = "new";
	document.forms[0].submit();
}

//22.02.2008, 01.03.2008 ----- entfernt in enma1_f.php
//-------------------------------------------------------------------------------------------
function JSC_ButtCreEnt()
{
	window.document.forms[0].FrmCommand.value = "action";
	window.document.forms[0].FrmValue.value = "r1";
	document.forms[0].submit();
}

//01.02.2008, 26.07.2008, 31.07.2008
//-------------------------------------------------------------------------------------------
function JSC_ButtLogin()
{
	window.document.forms[0].FrmCommand.value = "FrmButtLogin";
	window.document.forms[0].FrmValue.value = "dc";
	jsMd5 = hex_md5(window.document.forms[0].FrmPassword.value);
	window.document.forms[0].FrmPassword.value = hex_md5(jsMd5).substring(0, window.document.forms[0].FrmPassword.value.length);
	window.document.forms[0].FrmPassword2.value = jsMd5;
	document.forms[0].submit();
}

//02.02.2008, 27.07.2008
//-------------------------------------------------------------------------------------------
function JSC_ButtLogout()
{
	switch (window.document.forms[0].FrmSiteId.value)
	{
		case "enma1":	
		case "enma2":	window.document.forms[0].FrmAccoPassword.value = "";
						break;
		default:		
						break;
	}
	window.document.forms[0].FrmCommand.value = "FrmButtLogout";
	window.document.forms[0].FrmValue.value = "dc";
	document.forms[0].submit();
}

//08.02.2008, 23.02.2008 ----- entfernt in dema2_f.php
//-------------------------------------------------------------------------------------------
function JSC_ButtSavDev()
{
	window.document.forms[0].FrmCommand.value = "rec";
	window.document.forms[0].FrmValue.value = "save";
	document.forms[0].submit();
}

//03.02.2008, 23.02.2008
//-------------------------------------------------------------------------------------------
function JSC_ButtSelDev(jsUnitProjPk)
{
	window.document.forms[0].FrmCommand.value = "FrmButtSelDev";
	window.document.forms[0].FrmValue.value = jsUnitProjPk;
	document.forms[0].submit();
}

//04.02.2008, 09.02.2008
//-------------------------------------------------------------------------------------------
function JSC_ButtSelManDev(jsElement, jsUnal)
{
	jsCmd = window.document.getElementById(jsElement).value;
	
	switch (jsCmd)
	{
		case "2":	window.document.forms[0].FrmDevice.value = jsUnal;
					window.document.forms[0].action = "dema2.php";
					document.forms[0].submit();
					break;
		case "3":	var jsAnswer = confirm("Soll dieses Gerät wirklich gelöscht werden?");
					if (jsAnswer == true)
					{
						window.document.forms[0].FrmCommand.value = "rec";
						window.document.forms[0].FrmValue.value = window.document.getElementById(jsElement).value;
						window.document.forms[0].FrmDevice.value = jsUnal;
						document.forms[0].submit();
					}
					else
					{
						window.document.getElementById(jsElement).value = 0;
					}
					break;
		default:	
					break;
	}
}

//01.02.2008
//-------------------------------------------------------------------------------------------
function JSC_Keypress(eventnetscape)
{
	if (eventnetscape)
	{
		jsKeyCode = eventnetscape.which;
		jsElement = eventnetscape.target.name;
	}
	else
	{
		jsKeyCode = window.event.keyCode;
		jsElement = event.srcElement.name;
	}
	
	if (jsKeyCode == 13)
	{
		switch(jsElement)
		{
			case "FrmPassword":			JSC_ButtLogin();
										break;
//			case "FrmButtLogin":		JSC_ButtLogin();
//										break;
//			case "FrmButtSubmit":		JSC_ButtSubmit();
//										break;
//			case "FrmButtReset":		JSC_ButtReset;
//										break;
		}
	}
}

//31.01.2008
//----- Toggle TeXT LiNK --------------------------------------------------------------------
function JSC_ToggleTxtLnk(jsElement, jsAction)
{
	switch (jsAction)
	{
		case "out":		window.document.getElementById(jsElement).className = "m1t";
						break;
		case "over":	window.document.getElementById(jsElement).className = "m1ts";
						break;
	}
}

//31.01.2008
//----- Toggle BUtton CSs -------------------------------------------------------------------
function JSC_ToggleButCss(jsElement, jsAction)
{
	switch (jsAction)
	{
		case 0:	window.document.getElementById(jsElement).className = "login_sb0";
				break;
		case 1:	window.document.getElementById(jsElement).className = "login_sb1";
				break;
	}
}
function JSC_ToggleButtCss(jsElement, jsAction)
{
	switch (jsAction)
	{
		case 0:	window.document.getElementById(jsElement).className = "bucs0";
				break;
		case 1:	window.document.getElementById(jsElement).className = "bucs1";
				break;
	}
}

//23.02.2008
//-------------------------------------------------------------------------------------------
function JSC_DemaSelAct(jsElement, jsUnitPk)
{
	jsCmd = window.document.getElementById(jsElement).value;
	
	switch (jsCmd)
	{
		case "r2":	window.document.forms[0].FrmDevice.value = jsUnitPk;
					window.document.forms[0].action = "dema2.php";
					document.forms[0].submit();
					break;
		case "r5":	window.document.forms[0].FrmDevice.value = jsUnitPk;
					window.document.forms[0].action = "dema5.php";
					document.forms[0].submit();
					break;
		default:	
					break;
	}
}

//22.02.2008
//-------------------------------------------------------------------------------------------
function JSC_EnmaSelAct(jsElement, jsEntePk)
{
	jsCmd = window.document.getElementById(jsElement).value;
	
	switch (jsCmd)
	{
		case "r2":	window.document.forms[0].FrmEnterprise.value = jsEntePk;
					window.document.forms[0].action = "enma2.php";
					document.forms[0].submit();
					break;
		case "r5":	window.document.forms[0].FrmEnterprise.value = jsEntePk;
					window.document.forms[0].action = "enma5.php";
					document.forms[0].submit();
					break;
//		case "r5":	var jsAnswer = confirm("Soll dieser Benutzername wirklich gelöscht werden?");
//					if (jsAnswer == true)
//					{
//						window.document.forms[0].FrmCommand.value = "action";
//						window.document.forms[0].FrmValue.value = "r3";
//						window.document.forms[0].FrmDevice.value = jsAccoPk;
//						document.forms[0].submit();
//					}
//					else
//					{
//						window.document.getElementById(jsElement).value = 0;
//					}
//					break;
		default:	
					break;
	}
}

//19.02.2008
//-------------------------------------------------------------------------------------------
function JSC_UsmaSelAct(jsElement, jsAccoPk)
{
	jsCmd = window.document.getElementById(jsElement).value;
	
	switch (jsCmd)
	{
//		case "2":	window.document.forms[0].FrmDevice.value = jsUnal;
//					window.document.forms[0].action = "dema2.php";
//					document.forms[0].submit();
//					break;
		case "r3":	var jsAnswer = confirm("Soll dieser Benutzername wirklich gelöscht werden?");
					if (jsAnswer == true)
					{
						window.document.forms[0].FrmCommand.value = "action";
						window.document.forms[0].FrmValue.value = "r3";
						window.document.forms[0].FrmDevice.value = jsAccoPk;
						document.forms[0].submit();
					}
					else
					{
						window.document.getElementById(jsElement).value = 0;
					}
					break;
		default:	
					break;
	}
}


