<!--
var AllowedChar = new Array();
var ErrorMsg = "Ungültiges Zeichen!";

function KeyNumber(Ereignis, extended, enableExtKey, shiftPressedKeys, ctrlPressedKeys, altPressedKeys)
	{
	var lExtended = false;
	if (typeof(extended)!='undefined')
	    lExtended = extended;
	
	if (lExtended)
	    AllowedChar = new Array(8, 9, 12, 13, 16, 17, 18, 27, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105);
	else
	    AllowedChar = new Array(8, 9, 12, 13, 16, 17, 18, 27, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57);
	  
	//AllowedChar: 44="komma", 45="minus", 48-57="null-neun"
	ErrorMsg = "Bitte eine Zahl eingeben!";
	if (lExtended)
	    return CheckKeyCode(Ereignis, extended, enableExtKey, shiftPressedKeys, ctrlPressedKeys, altPressedKeys);
	else
	    return CheckKeyCode(Ereignis);
	}
function OnlyKeyNumber(Ereignis, extended, enableExtKey)
    {
        AllowedChar = new Array(8, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105);
        return CheckKeyCode(Ereignis, false, false);
    }
function KeyDigit(Ereignis,extended, enableExtKey, shiftPressedKeys, ctrlPressedKeys, altPressedKeys)
	{
	var lExtended = false;
	var lExtendKey = false;
	if (typeof(extended)!='undefined')
	    lExtended = extended;
	
	if (lExtended)
	    AllowedChar = new Array(8, 9, 12, 13, 16, 17, 18, 27, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 110, 188);
	else
	    AllowedChar = new Array(8, 9, 12, 13, 16, 17, 18, 27, 33, 34, 35, 36, 37, 38, 39, 40, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 110);
	//AllowedChar: 48-57="null-neun"
	ErrorMsg = "Bitte nur Ziffern eingeben!";
	return CheckKeyCode(Ereignis, extended, enableExtKey, shiftPressedKeys, ctrlPressedKeys, altPressedKeys);
	}

function KeyDate(Ereignis, enableExtKey)
	{
	AllowedChar = new Array(8, 9, 37, 38, 39, 40, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57);
	//AllowedChar: 46="punkt", 48-57="null-neun"
	ErrorMsg = "Bitte ein Datum eingeben!";
	return CheckKeyCode(Ereignis, false, enableExtKey);
	}

function KeyTime(Ereignis)
	{
	AllowedChar = new Array(48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58);
	//AllowedChar: 48-57="null-neun", 58="doppelpunkt"
	ErrorMsg = "Bitte eine Uhrzeit eingeben!";
	return CheckKeyCode(Ereignis);
	}

function KeyDateTime(Ereignis)
	{
	AllowedChar = new Array(32, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58);
	//AllowedChar: 32="leerzeichen", 46="punkt", 48-57="null-neun", 58="doppelpunkt"
	ErrorMsg = "Bitte ein Datum/Uhrzeit eingeben!";
	return CheckKeyCode(Ereignis);
	}

function KeyeMail(Ereignis)
	{
	AllowedChar = new Array(45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 95, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122);
	//AllowedChar: 45="bindestrich", 46="punkt", 48-57="null-neun", 64="klammeraffe", 65-90="A-Z", 95="unterstrich", 97-122="a-z"
	ErrorMsg = "Bitte eine eMail-Adresse eingeben!";
	return CheckKeyCode(Ereignis);
	}

function KeyUserDef(Ereignis,ChrSet,Msg)
	{
	AllowedChar = new Array();
	var NewElement = 0;
	if (ChrSet != "")
		for (var i=0; i<ChrSet.length; i++)
			NewElement = AllowedChar.push(ChrSet.charCodeAt(i));
	if (Msg == "")
		ErrorMsg = "Ungültiges Zeichen!";
	else
		ErrorMsg = Msg;
	return CheckKeyCode(Ereignis);
	}

var KeyPressLen = 0;
function KeyCheckTA(Ereignis, sThis, MaxLen){
    AllowedChar = new Array(8, 9, 37, 38, 39, 40, 46);
    var aktLen = sThis.value.length;
    KeyPressLen = aktLen;
    var ret = true;
    if (aktLen >= MaxLen){
        ret = CheckKeyCode(Ereignis);
    }
    return ret;
}

function KeyTASetDocPlaceholder(Ereignis, sThis, MaxLen, sIDAnz){
    var aktTxt = sThis.value
    var aktLen = aktTxt.length;
    var keyback = false;
    var CurrentChar = Ereignis.keyCode ? Ereignis.keyCode : Ereignis.charCode ? Ereignis.charCode : Ereignis.which;
    if (CurrentChar == 8 || CurrentChar == 46)
        keyback = true;
    var addTxt = false;
    var delTxt = false;
    if (Ereignis.ctrlKey && CurrentChar == 118)
        addTxt = true;
    else if (Ereignis.ctrlKey && CurrentChar == 120)
        delTxt = true;
        
    var AddLen = 0;
    if (delTxt)
        AddLen = KeyPressLen - aktLen
    else if (addTxt)
        AddLen = aktLen - KeyPressLen
    
    var setVal = (MaxLen - (aktLen + AddLen));
    if (setVal < 0){
        sThis.value = left(aktTxt,MaxLen);
        setVal = 0;
    }
    if (ge(sIDAnz))
        ge(sIDAnz).innerHTML = setVal;

}

function CheckKeyCode(Ereignis, extended, enableExtKey, shiftPressedKeys, ctrlPressedKeys, altPressedKeys)
	{
	var CharOK = false;
	var shiftPressed = Ereignis.shiftKey;
    var altPressed = Ereignis.altKey;
    var ctrlPressed = Ereignis.ctrlKey;
	var extend = false;
	var enableExtendKey = true;
	if (typeof(extended)!='undefined')
	    extend = extended;
	if (typeof(enableExtKey)!='undefined')
	    enableExtendKey = enableExtKey;
	    
	//if (Ereignis.charCode == 0) //d.h. Navigationstaste unter Netscape, dann OK
	//	return true;
	// gedrücktes Zeichen einlesen (verschiedene Browser benutzen verschiedene Befehle)
	var CurrentChar = Ereignis.keyCode ? Ereignis.keyCode : Ereignis.charCode ? Ereignis.charCode : Ereignis.which;
	if (CurrentChar > 255) //d.h. Navigationstaste unter Opera, dann OK
		return true;
    if (extend)
        if (CurrentChar == 17 || CurrentChar == 18)
	        return true;
	//alert(CurrentChar)
	if (CurrentChar) 
		for (var i in AllowedChar) 
			if (AllowedChar[i] == CurrentChar) 
				CharOK = true;
	
	if (extend)
	    if (shiftPressed || altPressed || ctrlPressed)
	        CharOK = true;
	        
	if (!enableExtendKey && (shiftPressed || altPressed || ctrlPressed))
	    CharOK = false;
	    
	if (typeof(shiftPressedKeys) != 'undefined'){
	    if (shiftPressed && (','+shiftPressedKeys + ',').indexOf((',' + CurrentChar + ',')) != -1)
	        CharOK = true;
	}
	if (typeof(ctrlPressedKeys) != 'undefined'){
	    if (ctrlPressed && (','+ctrlPressedKeys + ',').indexOf((',' + CurrentChar + ',')) != -1)
	        CharOK = true;
	}
	if (typeof(altPressedKeys) != 'undefined'){
	    if (altPressed && (','+altPressedKeys + ',').indexOf((',' + CurrentChar + ',')) != -1)
	        CharOK = true;
	}     
	return CharOK;
	}

function CheckNumber(Inputfeld)
	{
	var CheckOK = true;
	var txtNumber = Inputfeld.value;
	txtNumber = txtNumber.replace(",",".")
	if (txtNumber != "")
		if (isNaN(txtNumber))
			CheckOK = false;
	if (! CheckOK)
		{
		alert("Keine gültige Zahl!");
		Inputfeld.value = "";
		Inputfeld.focus();
		}
	}

function CheckDigit(Inputfeld)
	{
	var CheckOK = true;
	var txtDigit = Inputfeld.value;
	if (txtDigit != "")
		if (isNaN(txtDigit))
			CheckOK = false;
	if (! CheckOK)
		{
		alert("Keine gültigen Ziffern!");
		Inputfeld.focus();
		}
	}

function ValidDate(txtDate){
    var lRet
	if (txtDate == '')
        lRet = true;
	else{
	
	    rex=/\b(0[1-9]|[12][0-9]|3[01])\.(1[0-2]|0[1-9])\.(\d{4}$)/;
	    lRet = rex.test(txtDate);
	    if (lRet)
	    	if (txtDate.substring(6,10) < 1900)
	            lRet = false;
	}
	return lRet;
}

function ValidTime(txtTime){
	var CheckOK = true;
    var RegExp1 = new RegExp(/((0|1)[0-9]|2[0-3]):[0-5][0-9]/);
    CheckOK = RegExp1.test(txtTime.value)
	return CheckOK;
}

function CheckDate(Inputfeld){
	if (!ValidDate(Inputfeld.value)){
	    var dlg = new msgBox(null);
		dlg.show(poolBez,'Kein gültiges Datums-Format. (TT.MM.JJJJ)',1,'WARN');
	}
}

function CheckTime(Inputfeld){
	if (! ValidTime(Inputfeld.value) && Inputfeld.value.length > 0 && Inputfeld.value != '__:__' && Inputfeld.value != 'HH:MM'){
	    var dialog = new Dialog();
	    dialog.show(poolBez,'Kein gültiges Zeit-Format!', 1, 'WARN', new function() {Inputfeld.focus();});
	}
}

function CheckDateTime(Inputfeld)
	{
	var DatePart = Inputfeld.value;
	var TimePart = "";
	var Blank = DatePart.indexOf(" ");
	if (Blank >= 0)
		{
		TimePart = DatePart.substr(Blank+1,99)
		DatePart = DatePart.substr(0,Blank)
		}
	if (! ValidDate(DatePart))
		{
		alert("Kein gültiges Datums-Format!");
		Inputfeld.focus();
		}
	else if (! ValidTime(TimePart))
		{
		alert("Kein gültiges Zeit-Format!");
		Inputfeld.focus();
		}
	}

function CheckeMail(Inputfeld,NoMsg)
	{
	var CheckOK = true;
	var txteMail = Inputfeld.value;
	if (txteMail != "")
		{
			CheckOK = !txteMail.search(/[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+(?:[a-zA-Z]{2}|com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum)\b/);
		}
	if (! CheckOK)
		{
		if (!NoMsg) {
 			alert("Kein gültiges eMail-Format!");
			Inputfeld.focus();
		}
		}
	return CheckOK;
	}

function CheckUserDef(Inputfeld,ChrSet,Msg)
	{
	AllowedChar = new Array();
	var NewElement = 0;
	if (ChrSet != "")
		for (var i=0; i<ChrSet.length; i++)
			NewElement = AllowedChar.push(ChrSet.charCodeAt(i));
	if (Msg == "")
		ErrorMsg = "Ungültiges Zeichen!";
	else
		ErrorMsg = Msg;
	var CheckOK = true;
	var txtUserDef = Inputfeld.value;
	var CharPos = 0;
	if (txtUserDef != "")
		while (CheckOK && (CharPos < txtUserDef.length))
		{
			CheckOK = (ChrSet.indexOf(txtUserDef.charAt(CharPos)) != -1);
			CharPos++;
		}
	if (! CheckOK)
		{
		alert(ErrorMsg);
		Inputfeld.focus();
		}
	}

//-->
