function weekDayName(wDay)
{
weekDayArr=new Array("Mo","Di","Mi","Do","Fr","Sa","So");
return weekDayArr[wDay];
}
function monthName(month)
{
monthNameArr=new Array(
"Januar","Februar","M&auml;rz","April","Mai","Juni","Juli",
"August","September","Oktober","November","Dezember");
return monthNameArr[--month];
}
function leapYear(year)
{
return((year&3)==0)&&(((year%100)!=0)||((year%400)==0));
}
function daysPerMonth(year,month)
{
dpmArr=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
var result=dpmArr[--month];
if(month==1)if(leapYear(year))result++;
return result;
}
function dayNoInYear(year,month,day){
var dayNo=0;
if(day<=daysPerMonth(year,month))
{
for(var i=1;i<month;i++)
dayNo+=daysPerMonth(year,i);
dayNo+=day;
}
return dayNo;
}
function calendarWeek(year,month,day)
{
var week=0;
var calcDate=new Date(year,0,1);
var day1Jan=calcDate.getDay()-1;
if(day1Jan==-1)day1Jan=6;
calcDate.setFullYear(year-1);
var day1JanPrev=calcDate.getDay()-1;
if(day1JanPrev==-1)day1JanPrev=6;
calcDate.setFullYear(year+1);
var day1JanNext=calcDate.getDay()-1;
if(day1JanNext==-1)day1JanNext=6;
var dayNo=dayNoInYear(year,month,day)-1;
if(day1Jan>3)
dayNo-=(7-day1Jan);
else
dayNo+=day1Jan;
if(dayNo<0)
if((day1Jan==4)||(day1JanPrev==3))
week=53;
else
week=52;
else week=Math.floor(dayNo / 7)+1;
if((dayNo>360)&&(week>52))
{
if(day1Jan==3)
week=53;
else if(day1JanNext==4)
week=53;
else
week=1;
}
return week;
}
function addDays(year,month,day,days)
{
if(days>=0)
{
day+=days;
while(day>daysPerMonth(year,month))
day-=daysPerMonth(year,month++);
}else{
day+=days;
while(day<=0)
day+=daysPerMonth(year,month--);
}
return(new Array(month,day));
}
function easterSunday(year){
var K=Math.floor(year / 100);
var h=Math.floor((3*K+3)/ 4);
var M=15+h-Math.floor((8*K+13)/ 25);
var S=2-h;
var A=year%19;
var B=Math.floor(year/4);
var D=(19*A+M)%30;
var R=Math.floor(D / 29)+(Math.floor(D / 28)-Math.floor(D / 29))*Math.floor(A / 11);
var OG=21+D-R;
var SZ=7-((year+B+S)%7);
var OE=7-((OG-SZ)%7);
return(addDays(year,3,1,(OG+OE)-1));
}
/*
uneinheitlicheFeiertage = new Object();
uneinheitlicheFeiertage['Heilige Drei Könige'] = array('BW','BY','ST');
uneinheitlicheFeiertage['Fronleichnam']        = array('BW','BY','HE','NW','RP','SL');
uneinheitlicheFeiertage['Mariä Himmelfahrt']   = array('BY','SL');
uneinheitlicheFeiertage['Reformationstag']     = array('BB','MV','SN','ST','TH');
uneinheitlicheFeiertage['Allerheiligen']       = array('BW','BY','NW','RP','SL');
uneinheitlicheFeiertage['Buß- und Bettag']     = array('SN');
*/
var bl = 'HH';
function feiertag(year,month,day)
{
if(month==1&&day==1)return('Neujahr');
if(month==1&&day==6&&(bl=='BW'||bl=='BY'||bl=='ST'))return('Heilige Drei K&ouml;nige');
if(month==5&&day==1)return('Maifeiertag');
if(month==8&&day==15&&(bl=='BY'||bl=='SL'))return('Mari&auml; Himmelfahrt');
if(year>1989&&month==10&&day==3)return('Tag der deutschen Einheit');
if(month==10&&day==31&&(bl=='BB'||bl=='MV'||bl=='SN'||bl=='ST'||bl=='TH'))return('Reformationstag');
if(month==11&&day==1&&(bl=='BW'||bl=='BY'||bl=='NW'||bl=='RP'||bl=='SL'))return('Allerheiligen');
if(month==12&&day==24)return('Heiligabend');
if(month==12&&day==25)return('1. Weihnachtstag');
if(month==12&&day==26)return('2. Weihnachtstag');
if(month==12&&day==31)return('Silvester');
if(month==11)
{
var fourthAdvent=24-(new Date(year,11,24)).getDay();
if(day==(fourthAdvent-2)&&(bl=='SN'))return('Bu&szlig;- und Bettag');
}
if(month==3||month==4||month==5||month==6)
{
easter=easterSunday(year);
tempDate=addDays(year,easter[0],easter[1],-2);
if(month==tempDate[0]&&day==tempDate[1])return('Karfreitag');
tempDate=addDays(year,easter[0],easter[1],1);
if(month==tempDate[0]&&day==tempDate[1])return('Ostermontag');
tempDate=addDays(year,easter[0],easter[1],39);
if(month==tempDate[0]&&day==tempDate[1])return('Himmelfahrt');
tempDate=addDays(year,easter[0],easter[1],50);
if(month==tempDate[0]&&day==tempDate[1])return('Pfingstmontag');
tempDate=addDays(year,easter[0],easter[1],60);
if(month==tempDate[0]&&day==tempDate[1]&&(bl=='BW'||bl=='BY'||bl=='HE'||bl=='NW'||bl=='RP'||bl=='SL'))return('Fronleichnam');
}
return('');
}
function isSpecialDate(year,month,day,specialDatesIndex)
{
var dateStr=year+(month<10?"0":"")+month+(day<10?"0":"")+day;
for(i=0;i<specialDates[specialDatesIndex].length;i++)
{
if(specialDates[specialDatesIndex][i]==dateStr)
{
return true;
}
}
return false;
}
function writeCalendarMonthCell(calendarWin,Inhalt,HgFarbe,SchrFarbe,SchrGroesse,SchrArt)
{
calendarWin.document.writeln('<td align="center" valign="middle" bgcolor="'+HgFarbe+'">');
calendarWin.document.writeln('<font size="'+SchrGroesse+'" color="'+SchrFarbe+'" face="'+SchrArt+'"><b>');
calendarWin.document.writeln(Inhalt);
calendarWin.document.writeln("<\/b><\/font><\/td>");
}
function writeCalendarMonthHeader(calendarWin,monthTitle,HgFarbe,SchrFarbe,SchrGroesse,SchrArt)
{
calendarWin.document.writeln("<tr>");
calendarWin.document.writeln('<td align="center" colspan="8" valign="middle" bgcolor="'+HgFarbe+'">');
calendarWin.document.writeln('<font size="'+SchrGroesse+'" color="'+SchrFarbe+'" face="'+SchrArt+'"><b>');
calendarWin.document.writeln('<i>'+monthTitle+"</i>");
calendarWin.document.writeln("<\/b><\/font><\/td><\/tr>");
calendarWin.document.writeln("<tr>");
writeCalendarMonthCell(calendarWin,"&nbsp;",HgFarbe,SchrFarbe,SchrGroesse,SchrArt);
for(var i=0;i<=6;i++)
writeCalendarMonthCell(calendarWin,weekDayName(i),HgFarbe,SchrFarbe,SchrGroesse,
SchrArt);
calendarWin.document.writeln("<\/tr>");
}
function writeCalendarMonth(calendarWin,year,month,specialDatesIndex)
{
var KSchrArt="Verdana,Arial";
var KSchrGroesse=2;
var KSchrFarbe="#000000";
var KWoSchrFarbe="#888888";
var Khgrund="#FFFFFF";
var TSchrArt="Verdana,Arial";
var TSchrGroesse=2;
var TSchrFarbe="#000000";
var Thgrund="#FFFFFF";
var SoFarbe="#FF0000";
var So2Farbe="#777777";
var Ahgrund="#FF4444";
var Shgrund="#00FF00";
var Sygrund="#AAFFAA";
var now=new Date();
var todayMonth=now.getMonth()+1;
var todayYear=now.getYear();
if(todayYear<999)todayYear+=1900;
var todayDay=now.getDate();
var firstDayInMonth=new Date(year,month-1,1);
var start=firstDayInMonth.getDay();
if(start>0)start--;
else start=6;
var stop=daysPerMonth(year,month);
calendarWin.document.writeln('<table border="0" cellpadding="1" cellspacing="1" "width=100%">');
writeCalendarMonthHeader(calendarWin,
monthName(month)+" "+year,Khgrund,KSchrFarbe,KSchrGroesse,KSchrArt);
var feiertage="";
var istFeiertag="";
var curDayNo=1;
var cW="";
for(var i=0;i<=5;i++)
{
calendarWin.document.writeln("<tr>");
cW=calendarWeek(year,month,curDayNo);
if(cW<10)
cW="&nbsp;&nbsp;"+cW;
writeCalendarMonthCell(calendarWin,
curDayNo>stop?"&nbsp;":cW,
Khgrund,KWoSchrFarbe,TSchrGroesse,KSchrArt);
for(var j=0;j<=6;j++)
{
if((i==0)&&(j<start))
writeCalendarMonthCell(calendarWin,"&nbsp;",Thgrund,TSchrFarbe,TSchrGroesse,TSchrArt);
else{
if(curDayNo>stop)
writeCalendarMonthCell(calendarWin,"&nbsp;",Thgrund,TSchrFarbe,TSchrGroesse,TSchrArt);
else{
var hgrund=Thgrund;
var schrFarbe=TSchrFarbe;
istFeiertag=feiertag(year,month,curDayNo);
if(istFeiertag!='')
if(istFeiertag.substr(0,1)!=' ')
feiertage+=istFeiertag+" "+curDayNo+"."+month+".<br>";
else
feiertage+="<i>"+istFeiertag+" "+curDayNo+"."+month+"</i>"+".<br>";
if(j==6||istFeiertag!='')
{
if(istFeiertag.substr(0,1)!=' ')
schrFarbe=SoFarbe;
else
schrFarbe=So2Farbe;
}
if((year==todayYear)&&(month==todayMonth)&&(curDayNo==todayDay))
hgrund=Ahgrund;
if(isSpecialDate(year,month,curDayNo,specialDatesIndex))
{
hgrund=Shgrund;
var tmpDate=new Date(year,month-1,curDayNo);
if(tmpDate<now)
hgrund=Sygrund;
}
writeCalendarMonthCell(calendarWin,curDayNo,hgrund,schrFarbe,TSchrGroesse,TSchrArt);
curDayNo++;
}
}
}
calendarWin.document.writeln("<\/tr>");
}
calendarWin.document.writeln("<tr>");
calendarWin.document.writeln('<td align="left" colspan="8" valign="middle">');
if(feiertage=='')
calendarWin.document.writeln("&nbsp;");
else
calendarWin.document.writeln('<center>'+feiertage+'<\/center>');
calendarWin.document.writeln('<\/td><\/tr>');
calendarWin.document.writeln("<\/table>");
}
function addMonths(year,month,months)
{
if(months>=0)
{
month+=months;
while(month>12)
{
month-=12;
year++;
}
}else{
month+=months;
while(month<=0)
{
month+=12;
year--;
}
}
return(new Array(year,month));
}
function yearCalendarWin(startYear,specialDatesIndex)
{
var widthCalendarWin=650;
var heightCalendarWin=800;
var leftCalendarWin=(screen.width / 2)-(widthCalendarWin / 2);
var topCalendarWin=(screen.height / 2)-(heightCalendarWin / 2)-50;
var calendarWin;
calendarWin=window.open("about:blank","",
"dependent=yes,width="+widthCalendarWin+",height="+heightCalendarWin+
",left="+leftCalendarWin+",top="+topCalendarWin);
calendarWin.document.open();
calendarWin.document.writeln(
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"+
"<html lang=\"de\">\n"+
"<head>\n"+
"<title>votian: Dauerauftrags-Ausf&uuml;hrungsdaten<\/title>\n"+
"<link rel=\"stylesheet\" type=\"text/css\" href=\"../css/phoenix.css.php\">\n"+
"<script type=\"text/javascript\">\n"+
"<!-"+"-\n"+
"function mkNewYearCalendarWin(startYear, specialDatesIndex)\n"+
"{\n"+
"  self.close();\n"+
"  opener.yearCalendarWin(startYear, specialDatesIndex);\n"+
"}\n"+
"-"+"->\n"+
"</script>\n"+
"<\/head>\n"+
"<body>\n"+
"  <table border=0 align=center height=100% cellspacing=0 cellpadding=0 vspace=0 hspace=0>\n"+
"    <tr>\n");
calendarWin.document.writeln('<td align="center" valign="top">');
var now=new Date();
var startMonth=1;
var todayYear=now.getYear();
if(todayYear<999)todayYear+=1900;
writeCalendarMonth(calendarWin,startYear,startMonth,specialDatesIndex);
calendarWin.document.writeln('<\/td>');
calendarWin.document.writeln('<td>&nbsp;&nbsp;<\/td>');
calendarWin.document.writeln('<td align="center" valign="top">');
dateArr=addMonths(startYear,startMonth,1);
writeCalendarMonth(calendarWin,dateArr[0],dateArr[1],specialDatesIndex);
calendarWin.document.writeln('<\/td>');
calendarWin.document.writeln('<td>&nbsp;&nbsp;<\/td>');
calendarWin.document.writeln('<td align="center" valign="top">');
dateArr=addMonths(startYear,startMonth,2);
writeCalendarMonth(calendarWin,dateArr[0],dateArr[1],specialDatesIndex);
calendarWin.document.writeln('<\/td><\/tr>');
calendarWin.document.writeln('<tr>');
calendarWin.document.writeln('<td align="center" valign="top">');
dateArr=addMonths(startYear,startMonth,3);
writeCalendarMonth(calendarWin,dateArr[0],dateArr[1],specialDatesIndex);
calendarWin.document.writeln('<\/td>');
calendarWin.document.writeln('<td>&nbsp;&nbsp;<\/td>');
calendarWin.document.writeln('<td align="center" valign="top">');
dateArr=addMonths(startYear,startMonth,4);
writeCalendarMonth(calendarWin,dateArr[0],dateArr[1],specialDatesIndex);
calendarWin.document.writeln('<\/td>');
calendarWin.document.writeln('<td>&nbsp;&nbsp;<\/td>');
calendarWin.document.writeln('<td align="center" valign="top">');
dateArr=addMonths(startYear,startMonth,5);
writeCalendarMonth(calendarWin,dateArr[0],dateArr[1],specialDatesIndex);
calendarWin.document.writeln('<\/td><\/tr>');
calendarWin.document.writeln('<tr>');
calendarWin.document.writeln('<td align="center" valign="top">');
dateArr=addMonths(startYear,startMonth,6);
writeCalendarMonth(calendarWin,dateArr[0],dateArr[1],specialDatesIndex);
calendarWin.document.writeln('<\/td>');
calendarWin.document.writeln('<td>&nbsp;&nbsp;<\/td>');
calendarWin.document.writeln('<td align="center" valign="top">');
dateArr=addMonths(startYear,startMonth,7);
writeCalendarMonth(calendarWin,dateArr[0],dateArr[1],specialDatesIndex);
calendarWin.document.writeln('<\/td>');
calendarWin.document.writeln('<td>&nbsp;&nbsp;<\/td>');
calendarWin.document.writeln('<td align="center" valign="top">');
dateArr=addMonths(startYear,startMonth,8);
writeCalendarMonth(calendarWin,dateArr[0],dateArr[1],specialDatesIndex);
calendarWin.document.writeln('<\/td><\/tr>');
calendarWin.document.writeln('<tr>');
calendarWin.document.writeln('<td align="center" valign="top">');
dateArr=addMonths(startYear,startMonth,9);
writeCalendarMonth(calendarWin,dateArr[0],dateArr[1],specialDatesIndex);
calendarWin.document.writeln('<\/td>');
calendarWin.document.writeln('<td>&nbsp;&nbsp;<\/td>');
calendarWin.document.writeln('<td align="center" valign="top">');
dateArr=addMonths(startYear,startMonth,10);
writeCalendarMonth(calendarWin,dateArr[0],dateArr[1],specialDatesIndex);
calendarWin.document.writeln('<\/td>');
calendarWin.document.writeln('<td>&nbsp;&nbsp;<\/td>');
calendarWin.document.writeln('<td align="center" valign="top">');
dateArr=addMonths(startYear,startMonth,11);
writeCalendarMonth(calendarWin,dateArr[0],dateArr[1],specialDatesIndex);
calendarWin.document.writeln('<\/td>');
var prevStartYear=startYear-1;
var nextStartYear=startYear+1;
var prevYearLink="&nbsp;";
var nextYearLink="&nbsp;";
if(startYear>=todayYear)
prevYearLink="<input type=\"button\" value=\""+prevStartYear+"\" onClick=\"mkNewYearCalendarWin("+prevStartYear+","+specialDatesIndex+")\" accesskey=\"z\">&nbsp;\n";;
if(startYear<=todayYear)
nextYearLink="<input type=\"button\" value=\""+nextStartYear+"\" onClick=\"mkNewYearCalendarWin("+nextStartYear+","+specialDatesIndex+")\" accesskey=\"v\">&nbsp;\n";;
calendarWin.document.writeln(
"    <\/tr>\n"+
"    <tr><td colspan=2 align=left>\n"+
prevYearLink+
"    <\/td>\n"+
"    <td colspan=2 align=center>\n"+
"<input type=\"button\" value=\"Schließen\" onClick=\"self.close()\" accesskey=\"s\">&nbsp;\n"+
"    <\/td>\n"+
"    <td colspan=2 align=right>\n"+
nextYearLink+
"    <\/td><\/tr>\n"+
"  <\/table>\n"+
"<\/body>\n"+
"<\/html>\n");
calendarWin.document.close();
return calendarWin;
}

function calendarMonthCell(Inhalt, HgFarbe, SchrFarbe, SchrGroesse, SchrArt)
{
  var retVal =
    '<td align="center" valign="middle" bgcolor="'+ HgFarbe +'">' +
    '<font size="' + SchrGroesse + '" color="' + SchrFarbe + '" face="' + SchrArt + '"><b>' +
    Inhalt + "<\/b><\/font><\/td>";  

  return retVal;
}  

function calendarMonthHeader(monthTitle, HgFarbe, SchrFarbe, SchrGroesse, SchrArt, calendardiv, prevyear, prevmonth, nextyear, nextmonth, active)
{
  var retVal =
    '<tr><td bgcolor="'+HgFarbe+'"><a href=\"javascript:calendarMonthInit(\'' + calendardiv + '\', ' + prevyear + ', ' + prevmonth + ', ' + active + ');\"><b>&lt;</b></a></td>' +
    '<td align="center" colspan="6" valign="middle" bgcolor="'+HgFarbe+'">' +
    '<font size="'+SchrGroesse+'" color="'+SchrFarbe+'" face="'+SchrArt+'"><b>' +
    '<i>'+monthTitle+"</i>" +
    '<\/b><\/font><\/td>' +
    '<td bgcolor="'+HgFarbe+'" align="right"><a href=\"javascript:calendarMonthInit(\'' + calendardiv + '\', ' + nextyear + ', ' + nextmonth + ', ' + active + ');\"><b>&gt;</b></a></td><\/tr><tr>' +
    calendarMonthCell("&nbsp;", HgFarbe, SchrFarbe, SchrGroesse, SchrArt);
  for(var i = 0; i <= 6; i++)
    retVal += calendarMonthCell(weekDayName(i), HgFarbe, SchrFarbe, SchrGroesse, SchrArt);
  retVal += "<\/tr>";

  return retVal;
}

var not_after_time = "19:00:00";

function calendarMonth(calendardiv, year, month, active, pastdays)
{
  var KSchrArt = "Verdana,Arial"; /* Schriftart Kalenderkopf */
  var KSchrGroesse = 2;           /* Schriftgroesse 1-7 Kalenderkopf */
  var KSchrFarbe = "#000000";     /* Schriftfarbe Kalenderkopf */
  var KWoSchrFarbe = "#888888";   /* Schriftfarbe Kalenderwochen */
  var Khgrund = "#FFFFFF";        /* Hintergrundfarbe Kalenderkopf */
  var TSchrArt = "Verdana,Arial"; /* Schriftart Tagesanzeige */
  var TSchrGroesse = 2;           /* Schriftgroesse 1-7 Tagesanzeige */
  var TSchrFarbe = "#000000";     /* Schriftfarbe Tagesanzeige */
  var Thgrund = "#FFFFFF";        /* Hintergrundfarbe Tagesanzeige */
  var SoFarbe = "#FF0000";        /* Schriftfarbe f. Sonn- und Feiertage */
  var So2Farbe = "#777777";       /* Schriftfarbe uneinheitliche Feiertage */
  var Ahgrund = "#FF4444";        /* Hintergrundfarbe f. heutigen Tag */
  var Shgrund = "#00FF00";        /* Hintergrundfarbe f. spezielle Tage */
  var Sygrund = "#AAFFAA";        /* Hintergrundfarbe f. spezielle Tage in der Vergangenheit */

  var now = new Date();
  var todayMonth = now.getMonth() + 1;
  var todayYear = now.getYear();
  if (todayYear < 999) todayYear += 1900;
  var todayDay = now.getDate();
  var firstDayInMonth = new Date(year, month - 1, 1);
  var start = firstDayInMonth.getDay();
  if (start > 0) start--;
  else start = 6;
  var nowmillisecs = now.getTime();
  var stop = daysPerMonth(year, month);

  var prevyear = year;
  var prevmonth = month - 1;
  if (prevmonth == 0) {
    prevmonth = 12;
    prevyear--;
  }
  var nextyear = year;
  var nextmonth = month + 1;
  if (nextmonth == 13) {
    nextmonth = 1;
    nextyear++;
  }

  var calendarContent = '<table border="0" cellpadding="1" cellspacing="1" "width=100%">';
  calendarContent += calendarMonthHeader(monthName(month) + " " + year, Khgrund, KSchrFarbe, KSchrGroesse, KSchrArt, calendardiv, prevyear, prevmonth, nextyear, nextmonth, active);

  var feiertage = "";
  var istFeiertag = "";
  var curDayNo = 1;
  var cW = "";
  for(var i = 0; i <= 5; i++)
  {
    calendarContent += "<tr>";
    cW = calendarWeek(year, month, curDayNo);
    if (cW < 10)
      cW = "&nbsp;&nbsp;" + cW;
    calendarContent += calendarMonthCell(curDayNo > stop ? "&nbsp;" : cW, Khgrund, KWoSchrFarbe, TSchrGroesse, KSchrArt);
    for(var j = 0; j <= 6; j++)
    {
      if((i == 0) && (j < start))
        calendarContent += calendarMonthCell("&nbsp;", Thgrund, TSchrFarbe, TSchrGroesse, TSchrArt);
      else {
        if(curDayNo > stop)
          calendarContent += calendarMonthCell("&nbsp;", Thgrund, TSchrFarbe, TSchrGroesse, TSchrArt);
        else {
          var daycontent = '<a href=\"javascript:calendarFunc(' + year + ', ' + month + ', ' + curDayNo + ');\"><b>' + curDayNo + '</b></a>';
          if (!active || (!pastdays && Date.parse(month + "/" + curDayNo + "/" + year + " " + not_after_time) < nowmillisecs))
            daycontent = curDayNo;         
          var hgrund = Thgrund;
          var schrFarbe = TSchrFarbe;
          istFeiertag = feiertag(year, month, curDayNo);
          if (istFeiertag != '')
            if (istFeiertag.substr(0,1) != ' ')
              feiertage += istFeiertag + " " + curDayNo + "." + month + ".<br>";
            else
              feiertage += "<i>" + istFeiertag + " " + curDayNo + "." + month  + "</i>" + ".<br>";
          if (j == 6 || istFeiertag != '')
          {
            if (istFeiertag.substr(0,1) != ' ') {
              schrFarbe = SoFarbe;
              daycontent = curDayNo;
            }
            else  
              schrFarbe = So2Farbe;
          }  
          if((year == todayYear) && (month == todayMonth) && (curDayNo == todayDay))
            hgrund = Ahgrund;
          calendarContent += calendarMonthCell(daycontent, hgrund, schrFarbe, TSchrGroesse, TSchrArt);
          curDayNo++;
        }
      }
    }
    calendarContent += "<\/tr>";
  }
  calendarContent += "<tr>";
  calendarContent += '<td align="left" colspan="8" valign="middle">';
//  if (feiertage == '')
//    calendarContent = + "&nbsp;";
//  else  
//    calendarContent += '<center>' + feiertage + '<\/center>';
  calendarContent +=  "<center><i><a href=\"javascript:calendarCloseFunc();\">Kalender schlie&szlig;en</a></i></center>"
  calendarContent += '<\/td><\/tr>';
//  calendarContent += '<\/table>';

  return(calendarContent);
}

var curyear = 0;
var curmonth = 0;
var curcalendardiv = "";

function calendarActivate() {
  calendarMonthInit(curcalendardiv, curyear, curmonth, true)
}

function calendarDeactivate() {
  calendarMonthInit(curcalendardiv, curyear, curmonth, false)
}

function calendarClose(calendardiv) {
  $('#' + calendardiv).html("");
}

function calendarMonthInit(calendardiv, year, month, active, pastdays) {
  pastdays = typeof pastdays !== 'undefined' ? pastdays : false;	

  if (year == 0 && month == 0) {
    var now = new Date();
    var month = now.getMonth() + 1;
    var year = now.getYear();
    if (year < 999) year += 1900;
  }
  curyear = year;
  curmonth = month;
  curcalendardiv = calendardiv;
  $('#' + calendardiv).html(calendarMonth(calendardiv, year, month, active, pastdays));
}
