	var day;
	var month;
	var year;
	var curfield = 1;

	function add0(number) { return (number < 10) ? '0' + number : number; }

	function restart() {
		switch (curfield) {
			case 0:
				document.send_question.pole_0.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 1:
//				var fieldnr = eval("document.send_question.pole_" + curfield + ".value");
//				fieldnr = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); 
				document.send_question.pole_1.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 2:
				document.send_question.pole_2.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 3:
				document.send_question.pole_3.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 4:
				document.send_question.pole_4.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 5:
				document.send_question.pole_5.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 6:
				document.send_question.pole_6.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 7:
				document.send_question.pole_7.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 8:
				document.send_question.pole_8.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 9:
				document.send_question.pole_9.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 10:
				document.send_question.pole_10.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 11:
				document.send_question.pole_11.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 12:
				document.send_question.pole_12.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 13:
				document.send_question.pole_13.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 14:
				document.send_question.pole_14.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 15:
				document.send_question.pole_15.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 16:
				document.send_question.pole_16.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 17:
				document.send_question.pole_17.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 18:
				document.send_question.pole_18.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 19:
				document.send_question.pole_19.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 20:
				document.send_question.pole_20.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 21:
				document.send_question.pole_21.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 22:
				document.send_question.pole_22.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 23:
				document.send_question.pole_23.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 24:
				document.send_question.pole_24.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 25:
				document.send_question.pole_25.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 26:
				document.send_question.pole_26.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 27:
				document.send_question.pole_27.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 28:
				document.send_question.pole_28.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 29:
				document.send_question.pole_29.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 30:
				document.send_question.pole_30.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 31:
				document.send_question.pole_31.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 32:
				document.send_question.pole_32.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 33:
				document.send_question.pole_33.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 34:
				document.send_question.pole_34.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 35:
				document.send_question.pole_35.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 36:
				document.send_question.pole_36.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 37:
				document.send_question.pole_37.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 38:
				document.send_question.pole_38.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 39:
				document.send_question.pole_39.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
			case 40:
				document.send_question.pole_40.value = '' + year + '-' + add0(month - 0 + 1) + '-' + add0(day); break;
		}
		kWin.close();
	}


	var kWin;	
	function CalWin(field, date) {
		curfield = field;
		if (kWin) { 
			//kWin.close()
		}
		kWin=eval("open('kalendarz.php?dt=" + date + "','','resizable=no,width=250,height=185,left=525,top=100')");
		if (kWin.opener == null) kWin.opener = self;
		kWin.focus();
	}


