function ppup(){
	popup=window.open('','popup','scrollbars=yes,width=476,height=400,locationbar=0,menubar=0,resizable=0,status=0');
	popup.focus();
}

function completeDate(control)
{
	control.value=control.value.replace(/\s/g,'');
	// vereinfachte Datumseingabe: 101104 => 10.11.2004
	if (control.value.indexOf(".") == -1) // Angabe darf noch keinen Punkt enthalten
	{
		if ((control.value.length==6) || (control.value.length==8)) // entweder 101104 oder 10112004
		{
			var dd = control.value.substr(0,2);
			if(parseInt(dd,10)==0)
			{
				dd="01";
			}
			var mm = control.value.substr(2,2);
			if(parseInt(mm,10)==0)
			{
				mm="01";
			}
			var yy = control.value.substr(4,4);
			//alert (dd + " " + mm + "  " + yy);
			
			if (isNaN(yy) == false)
			{
				if (yy.length == 2)
				{
					if (parseInt(yy,10) < 20)
					{
						yy = parseInt(2000+parseInt(yy,10),10);					
					}
					else
					{
						yy = parseInt(1900+parseInt(yy,10),10);
					}
				}
				control.value=dd+"."+mm+"."+yy;
			}
		}
	}
	else if(control.value.match(/\./g).length==2)  // im  Datum müssen zwei '.' enthalten sein	
	{				
		var datum=control.value.split(".");
		var dd=datum[0];
		var mm=datum[1];
		var yy=datum[2];
		if(dd.length<2)
		{
			dd="0"+dd;
		}
		if(parseInt(dd,10)==0)
		{
			dd="01";
		}
		if(mm.length<2)
		{
			mm="0"+mm;
		}
		if(parseInt(mm,10)==0)
		{
			mm="01";
		}
		if (isNaN(yy) == false)
		{
			if (yy.length <= 2)
			{
				if (parseInt(yy,10) < 20)
				{
					yy = parseInt(2000+parseInt(yy,10),10);					
				}
				else
				{
					yy = parseInt(1900+parseInt(yy,10),10);
				}
			}
			control.value=dd+"."+mm+"."+yy;
		}		
	}
	if(control.value.length!=10)
	{
		control.focus();
	}
}
