// JavaScript Document
 
	function check_textarea_length(id_name, int_max) {
	 		 
		var ta_inhalt;
		var obj;
		 
		ta_inhalt = document.getElementById(id_name).value
		
		if (ta_inhalt.length > int_max) {
			document.getElementById(id_name).style.backgroundColor="#ff0000";
			//document.getElementById(id_name).value=ta_inhalt.substring(0,int_max);
			obj = document.getElementById("unter_"+id_name).firstChild;
			obj.nodeValue = "Max. " + int_max + " Zeichen! (" + ta_inhalt.length + "/" + int_max + ")";
			document.getElementById(id_name).blur();
			document.getElementById(id_name).focus();
			
		} else {
			document.getElementById(id_name).style.backgroundColor="";
			obj = document.getElementById("unter_"+id_name).firstChild;
			obj.nodeValue = "(" + ta_inhalt.length + "/" + int_max + ")";
			
		}
		
	}


	function chk_inputmask(id_name,str_inputmask, str_fehlermeldung) {
			
		var str_input = document.getElementById(id_name).value;
		
		switch(str_inputmask) {		
		
			case "L":
			case "LL":
			case "LLL":
			case "LLLL":
			case "LLLLL":
			case "LLLLLL":
			case "LLLLLLL":
			case "LLLLLLLL":
			case "LLLLLLLLL":
			case "LLLLLLLLLL":
			case "LLLLLLLLLLL":
			case "LLLLLLLLLLLL":
			case "LLLLLLLLLLLLL":
			case "LLLLLLLLLLLLLL":
			case "LLLLLLLLLLLLLLL":
			case "LLLLLLLLLLLLLLLL":
			case "LLLLLLLLLLLLLLLLL":
			case "LLLLLLLLLLLLLLLLLL":
			case "LLLLLLLLLLLLLLLLLLL":
			case "LLLLLLLLLLLLLLLLLLLL":
			
				if (str_input.length != str_inputmask.length && str_input.length > 0) {
					document.getElementById(id_name).style.backgroundColor="#ff0000";
					if (str_fehlermeldung != undefined && str_fehlermeldung != "") {
						alert(str_fehlermeldung);
					} else {
						alert("Beachten Sie, dass Sie hier genau " + str_inputmask.length + " Zeichen zulaessig sind/ist!");
					}
				} else {
					document.getElementById(id_name).style.backgroundColor="";
				}
				
				break;

			case "M":
			case "MM":
			case "MMM":
			case "MMMM":
			case "MMMMM":
			case "MMMMMM":
			case "MMMMMMM":
			case "MMMMMMMM":
			case "MMMMMMMMM":
			case "MMMMMMMMMM":
			case "MMMMMMMMMMM":
			case "MMMMMMMMMMMM":
			case "MMMMMMMMMMMMM":
			case "MMMMMMMMMMMMMM":
			case "MMMMMMMMMMMMMMM":
			case "MMMMMMMMMMMMMMMM":
			case "MMMMMMMMMMMMMMMMM":
			case "MMMMMMMMMMMMMMMMMM":
			case "MMMMMMMMMMMMMMMMMMM":
			case "MMMMMMMMMMMMMMMMMMMM":
			
				if (str_input.length > str_inputmask.length) {
					document.getElementById(id_name).style.backgroundColor="#ff0000";
					if (str_fehlermeldung != undefined && str_fehlermeldung != "") {
						alert(str_fehlermeldung);
					} else {
						alert("Beachten Sie, dass Sie hier max. " + str_inputmask.length + " Zeichen zulaessig sind!");
					}
				} else {
					document.getElementById(id_name).style.backgroundColor="";
				}
				
				break;

			case "0": 
			case "00":
			case "000":
			case "0000":
			case "00000":
			case "000000":
			case "0000000":
			case "00000000":
			case "000000000":
			case "0000000000":
			case "00000000000":
			case "000000000000":
			case "0000000000000":
			case "00000000000000":
			case "000000000000000":
			case "0000000000000000":
			case "00000000000000000":
			case "000000000000000000":
			case "0000000000000000000":
			case "00000000000000000000":
			
			
				if (isNaN(str_input)) {
					document.getElementById(id_name).style.backgroundColor="#ff0000";
					if (str_fehlermeldung != undefined && str_fehlermeldung != "") {
						alert(str_fehlermeldung);
					} else {
						alert("Beachten Sie, dass hier nur Ziffern zulaessig sind!");
					}
				}
				if (str_input.length != str_inputmask.length && str_input.length > 0) {
					document.getElementById(id_name).style.backgroundColor="#ff0000";
					if (str_fehlermeldung != undefined && str_fehlermeldung != "") {
						alert(str_fehlermeldung);
					} else {
						alert("Beachten Sie, dass Sie hier genau " + str_inputmask.length + " Ziffern zulaessig sind!");
					}
				} else {
					document.getElementById(id_name).style.backgroundColor="";
				}
				
				break;
				
			case "9": 
			case "99":
			case "999":
			case "9999":
			case "99999":
			case "999999":
			case "9999999":
			case "99999999":
			case "999999999":
			case "9999999999":
			case "99999999999":
			case "999999999999":
			case "9999999999999":
			case "99999999999999":
			case "999999999999999":
			case "9999999999999999":
			case "99999999999999999":
			case "999999999999999999":
			case "9999999999999999999":
			case "99999999999999999999":
			
			
				if (isNaN(str_input)) {
					document.getElementById(id_name).style.backgroundColor="#ff0000";
					if (str_fehlermeldung != undefined && str_fehlermeldung != "") {
						alert(str_fehlermeldung);
					} else {
						alert("Beachten Sie, dass hier nur Ziffern zulaessig sind!");
					}
				}					
				if (str_input.length > str_inputmask.length) {
					document.getElementById(id_name).style.backgroundColor="#ff0000";
					if (str_fehlermeldung != undefined && str_fehlermeldung != "") {
						alert(str_fehlermeldung);
					} else {
						alert("Beachten Sie, dass Sie hier max. " + str_inputmask.length + " Ziffern zulaessig sind!");
					}
				} else {
					document.getElementById(id_name).style.backgroundColor="";
				}
				break;
				
			default:
			
				break;
				
		}

	}
