function isLeapYear(j) {return ((j % 4 == 0) && ((j % 100 != 0) || (j % 400 == 0)));}
function wrongDate(this_handle) {
	t1 = "Ungueltiges Datumsformat: >> " + this_handle.value + " <<\n\n";
	t2 = "Erlaubte Trennzeichen: ', . / -' \n\nJahreszahl: 4stellig (1980-2020)\n\n";
	t3 = "z.B.:    01-12-1997        1.12.2001      31/12/2000     17,7,1981";
	alert(t1 + t2 + t3 + "\n\n[" + this_handle.name + "]");
	this_handle.value='';
	this_handle.focus();
}
function checkThisDate(this_handle) {
	datumstring = this_handle.value;
	if(datumstring == "") { return true; }
	text = datumstring.replace(/[^0-9.,-\/]/g,"");
	zahlen = text.split(/[ ,.\-\/]/);
	if(zahlen.length != 3) { wrongDate(this_handle); return false; }
	mtage = new Array (0,31,28,31,30,31,30,31,31,30,31,30,31);
	tag = zahlen[0]*1;
	monat = zahlen[1]*1;
	jahr = zahlen[2]*1;
	if(isLeapYear(jahr)) { mtage[2] = 29; }
	if((jahr < 1980) || (jahr > 2020)) { wrongDate(this_handle); return false; }
	if((monat < 1) || (monat > 12)) { wrongDate(this_handle); return false; }
	if((tag < 1) || (tag > mtage[monat])) { wrongDate(this_handle); return false; }
	if(tag < 10) { tag = "0" + tag; }
	if(monat < 10) { monat = "0" + monat; }
	this_handle.value = (tag + "." + monat + "." + jahr);
	return true;
}