<!--
var currentDay = -1;
var currentMonth = -1;
var currentYear = -1;
var savedCellBG = -1;
var selectedDay = -1;
var selectAction = 'alert(\'%d %m %y selected \')';
var cellHeight = '30px';
var cellWidth  = '30px';
var headHeight = '30px';
var fontSize   = '2pt';




	isNS4 = (document.layers) ? true : false;
	isIE4 = (document.all && !document.getElementById) ? true : false;
	isIE5 = (document.all && document.getElementById) ? true : false;
	isNS6 = (!document.all && document.getElementById) ? true : false;

// ------------------------------------------------------------6
function setDate(d, m, y) {
// ------------------------------------------------------------6
	 var s =  selectAction;
	 s = s.replace(/%d/, d);
	 s = s.replace(/%m/, m);
	 s = s.replace(/%y/, y);
	 eval(s);
}

// ------------------------------------------------------------6
function layerWrite(id,nestref,text) {
// ------------------------------------------------------------6
	if (isNS4) {
		var lyr = (nestref)? eval('document.'+nestref+'.document.'+id+'.document') : document.layers[id].document
		lyr.open()
		lyr.write(text)
		lyr.close()
	}
	
	else if (isIE4) document.all[id].innerHTML = text;
}

// ------------------------------------------------------------6
function leapYear (year) {
// ------------------------------------------------------------6
	if ((year % 400) == 0)
		return (true);

	if ((year % 100) == 0)
		return (false);

	if ((year % 4) == 0)
		return (true);

	return (false);
}
	
	monthName = new Array(12);
	monthName[0] = "Januar";
	monthName[1] = "Februar";
	monthName[2] = "M&auml;rz";
	monthName[3] = "April";
	monthName[4] = "Mai";
	monthName[5] = "Juni";
	monthName[6] = "Juli";
	monthName[7] = "August";
	monthName[8] = "September";
	monthName[9] = "Oktober";
	monthName[10] = "November";
	monthName[11] = "Dezember";

	dayName = new Array(7);
	dayName[0] = "So";
	dayName[1] = "Mo";
	dayName[2] = "Di";
	dayName[3] = "Mi";
	dayName[4] = "Do";
	dayName[5] = "Fr";
	dayName[6] = "Sa";

	daysInMonth = new Array(12);
	daysInMonth[0] = 31;
	daysInMonth[1] = 28;
	daysInMonth[2] = 31;
	daysInMonth[3] = 30;
	daysInMonth[4] = 31;
	daysInMonth[5] = 30;
	daysInMonth[6] = 31;
	daysInMonth[7] = 31;
	daysInMonth[8] = 30;
	daysInMonth[9] = 31;
	daysInMonth[10] = 30;
	daysInMonth[11] = 31;


	now = new Date();
	year = now.getYear();
	if (year < 1900) { 
		year += 1900;
	}
	month = now.getMonth();
	day   = now.getDate();
	now = null;
	now = new Date(year, month, 1);
	firstDay = now.getDay();	
	now = null;

	var monthToMark = month;
	 var dayToMark = day-1;

// ------------------------------------------------------------6
function generateKal(day, month, year, onSelectAction) {
// ------------------------------------------------------------6
    var RowIsOpen = false
	
	currentDay = day
    currentMonth = month;
    currentYear = year;
	selectAction = onSelectAction;
	month--;


	xdate = new Date(year, month, 1);
	firstDay = xdate.getDay();
	currentCell = 0;
	currentDate = 1;

	monthDays = daysInMonth[month];
	if (monthDays == 28) { 
	  if (leapYear(year)) { monthDays++; } 
	}

	text = "";
	text = '<form>';
	// Oberste Zeile
	text += '<table width="147" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff">';
	text += '<tr bgcolor="#898584">';
  	text += '<td width="1" height="1" bgcolor="#898584"><img src="blanker.gif" width="1" height="1"></td>';
	text += '<td  width="' + cellWidth + '" height="1"><img src="blanker.gif" width="' + cellWidth + '" height="1"></td>';
	text += '<td  width="' + cellWidth + '" height="1"><img src="blanker.gif" width="' + cellWidth + '" height="1"></td>';
	text += '<td  width="' + cellWidth + '" height="1"><img src="blanker.gif" width="' + cellWidth + '" height="1"></td>';
	text += '<td  width="' + cellWidth + '" height="1"><img src="blanker.gif" width="' + cellWidth + '" height="1"></td>';
	text += '<td  width="' + cellWidth + '" height="1"><img src="blanker.gif" width="' + cellWidth + '" height="1"></td>';
	text += '<td  width="' + cellWidth + '" height="1"><img src="blanker.gif" width="' + cellWidth + '" height="1"></td>';
	text += '<td  width="' + cellWidth + '" height="1"><img src="blanker.gif" width="' + cellWidth + '" height="1"></td>';
  	text += '<td width="1" height="1" bgcolor="#898584"><img src="blanker.gif" width="1" height="1"></td>';
	text += '</tr>';

	// Monatsname
	text += '<tr bgcolor="#D6D3CC">';
	text += '<td width="1" height="' + headHeight + '" bgcolor="#898584"><img src="blanker.gif" width="1" height="' + headHeight + '"></td>';
	text += '<td  colspan="7" height="' + headHeight + '" align="center" valign="middle"><font color="#000000" face="Arial" size=2>'+monthName[month]+' '+year+'</font></td>';
	text += '<td width="1" height="' + headHeight + '" bgcolor="#898584"><img src="blanker.gif" width="1" height="' + headHeight + '"></td>';
	text += '</tr>';
	
	// Abgrenzung Name - Tage
	text += '<tr bgcolor="#898584">';
  	text += '<td width="1" height="1" bgcolor="#898584"><img src="blanker.gif" width="1" height="1"></td>';
	text += '<td  height="1"><img src="blanker.gif" width="1" height="1"></td>';
	text += '<td  height="1"><img src="blanker.gif" width="1" height="1"></td>';
	text += '<td  height="1"><img src="blanker.gif" width="1" height="1"></td>';
	text += '<td  height="1"><img src="blanker.gif" width="1" height="1"></td>';
	text += '<td  height="1"><img src="blanker.gif" width="1" height="1"></td>';
	text += '<td  height="1"><img src="blanker.gif" width="1" height="1"></td>';
	text += '<td  height="1"><img src="blanker.gif" width="1" height="1"></td>';
  	text += '<td width="1" height="1" bgcolor="#898584"><img src="blanker.gif" width="1" height="1"></td>';
	text += '</tr>';

 	text += '<tr bgcolor="#ffffff">';
   	text += '<td width="1" height="' + cellHeight + '" bgcolor="#898584"><img src="blanker.gif" width="1" height="' + cellHeight + '"></td>';
	text += '<td  height="' + cellHeight + '" align="center" valign="middle"><font color="c0c0c0" size="'+ fontSize +'" face="Arial"><b>Mo</b></font></td>';
   	text += '<td  height="' + cellHeight + '" align="center" valign="middle"><font color="c0c0c0" size="'+ fontSize +'" face="Arial"><b>Di</b></font></td>';
   	text += '<td  height="' + cellHeight + '" align="center" valign="middle"><font color="c0c0c0" size="'+ fontSize +'" face="Arial"><b>Mi</b></font></td>';
   	text += '<td  height="' + cellHeight + '" align="center" valign="middle"><font color="c0c0c0" size="'+ fontSize +'" face="Arial"><b>Do</b></font></td>';
   	text += '<td  height="' + cellHeight + '" align="center" valign="middle"><font color="c0c0c0" size="'+ fontSize +'" face="Arial"><b>Fr</b></font></td>';
   	text += '<td  height="' + cellHeight + '" align="center" valign="middle"><font color="c0c0c0" size="'+ fontSize +'" face="Arial"><b>Sa</b></font></td>';
   	text += '<td  height="' + cellHeight + '" align="center" valign="middle"><font color="c0c0c0" size="'+ fontSize +'" face="Arial"><b>So</b></font></td>';
	text += '<td width="1" height="' + cellHeight + '" bgcolor="#898584"><img src="blanker.gif" width="1" height="' + cellHeight + '"></td>';
  	text += '</tr>';

	text += '  <tr height="2" bgcolor="#ffffff"> ';
	text += '    <td width="1" height="2" bgcolor="#898584"><img src="blanker.gif" width="1" height="2"></td>';
	text += '    <td  height="2" align="center" valign="middle"></td>';
	text += '    <td  height="2" align="center" valign="middle"></td>';
	text += '    <td  height="2" align="center" valign="middle"></td>';
	text += '    <td  height="2" align="center" valign="middle"></td>';
	text += '    <td  height="2" align="center" valign="middle"></td>';
	text += '    <td  height="2" align="center" valign="middle"></td>';
	text += '    <td  height="2" align="center" valign="middle"></td>';
	text += '    <td width="1" height="2" bgcolor="#898584"><img src="blanker.gif" width="1" height="2"></td>';
	text += '  </tr>';


   firstDay = (firstDay + 6) % 7;

   
	text += '  <tr height="16"> ';
	text += '    <td width="1" height="' + cellHeight + '" bgcolor="#898584"><img src="blanker.gif" width="1" height="' + cellHeight + '"></td>';
	RowIsOpen = true;


	if (firstDay > 0) {
		for (i = 0; i < firstDay; i++) { text += '<td  width="20" height="16" align="center" valign="middle"></td>' }
		currentCell = firstDay;
	}

    
	// Zellen Mit Datum fuellen
	while (currentDate <= monthDays) 
	{
		if (currentDate < 10) {
		  if (currentDate-1 == dayToMark && month == monthToMark) {
			 text += '<td bgcolor="#FFCC66" height="' + cellHeight + '" align="center" valign="middle" id="cell_'+currentDate +'">';
			 text += '<div class="cell" onClick="setDate('+currentDate+', '+ (month +1) +','+year+')" style="cursor:hand;"><font color="000000" size="'+ fontSize +'" face="Arial">0'+currentDate+'</font></div></TD>';
		  } else {
			 text += '<td bgcolor="#ffffff" height="' + cellHeight + '" align="center" valign="middle" id="cell_' + currentDate +'">';
			 text += '<div class="cell" onClick="setDate('+currentDate+', '+ (month +1) +','+year+')"  style="cursor:hand;"><font color="000000" size="'+ fontSize +'" face="Arial">0'+currentDate+'</font></div></TD>';
          }
		} else {
		  if (currentDate-1 == dayToMark && month == monthToMark) {
             text += '<td bgcolor="#99FFFF" height="' + cellHeight + '" align="center" valign="middle" id="cell_'+currentDate +'">';
			 text += '<div class="cell" onClick="setDate('+currentDate+', '+ (month +1) +','+year+')" style="cursor:hand;"><font color="000000" size="'+ fontSize +'" face="Arial">'+currentDate+'</font></div></TD>';
		  } else {
	         text += '<td bgcolor="#ffffff" height="' + cellHeight + '" align="center" valign="middle" id="cell_'+currentDate +'">';
			 text += '<div class="cell" onClick="setDate('+currentDate+', '+ (month +1) +','+year+')" style="cursor:hand;"><font color="000000" size="'+ fontSize +'" face="Arial">'+currentDate+'</font></div></TD>';
          }
		}

		currentDate++;
		currentCell++;
		if (currentCell > 6)
		{
            text += '    <td width="1" height="' + cellHeight + '" bgcolor="#898584"><img src="blanker.gif" width="1" height="' + cellHeight + '"></td>';
			text += '</TR>';
			currentCell = 0;
			RowIsOpen = false;
			if (currentDate <= monthDays) {
				text += '  <tr height="' + cellHeight + '"> ';
				text += '    <td width="1" height="' + cellHeight + '" bgcolor="#898584"><img src="blanker.gif" width="1" height="' + cellHeight + '"></td>';
				RowIsOpen = true;
	        }
		}		
	} // WEND

	// Rest auffuellen
	while ((currentCell < 7) && (RowIsOpen == true))
	{ 
  	  text += '<td  height="' + cellHeight + '" align="center" valign="middle"></td>' 
	  currentCell++;		
	}
    if (RowIsOpen == true)
    {
  	    text += '    <td width="1" height="' + cellHeight + '" bgcolor="#898584"><img src="blanker.gif" width="1" height="' + cellHeight + '"></td>';
	    text += '  </tr>';
    }

	text += '<tr bgcolor="#898584">';
  	text += '<td width="1" height="1" bgcolor="#898584"><img src="blanker.gif" width="1" height="1"></td>';
	text += '<td  height="1"><img src="blanker.gif" width="1" height="1"></td>';
	text += '<td  height="1"><img src="blanker.gif" width="1" height="1"></td>';
	text += '<td  height="1"><img src="blanker.gif" width="1" height="1"></td>';
	text += '<td  height="1"><img src="blanker.gif" width="1" height="1"></td>';
	text += '<td  height="1"><img src="blanker.gif" width="1" height="1"></td>';
	text += '<td  height="1"><img src="blanker.gif" width="1" height="1"></td>';
	text += '<td  height="1"><img src="blanker.gif" width="1" height="1"></td>';
  	text += '<td width="1" height="1" bgcolor="#898584"><img src="blanker.gif" width="1" height="1"></td>';
	text += '</tr>';

	text += '</Table></FORM>';
	month++;
//*/
	return text;
}

//-->
