
//CalendarX - Kalender mit Verfügbarkeitsinfos - (C)Infonautics GmbH, Switzerland

function show_calendar(AntwortFeld,CalStartMonat,CalStartJahr) { //nur 1. Parameter benutzt
   var CalMonths = ["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"];
   var CalDays = ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"];
   var CalTextTitel = "Kalender mit Verfügbarkeitsübersicht";
   var CalTextEinleitung = "Anreisedatum auswählen:";
   var CalTextMonatTag = "Monat&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tag";
   var CalTextZimmer0 = "Keine Zimmer verfügbar";
   var CalTextZimmer1 = "Zimmer verfügbar";
   
   CalArray = CalData.split("");
   CalWindow = window.open("","CalWin","menubar=0,location=0,directories=0,toolbar=0,status=0,scrollbars=0,resizable=0,width=650,height=330");
	CalWindow.opener = self;
	
	CalWindow.document.open();
	CalWindow.document.writeln("<HTML><HEAD><TITLE>" + CalTextTitel + "</TITLE>");
	CalWindow.document.writeln("<META HTTP-EQUIV='Content-Type' CONTENT='text/html;charset=iso-8859-1'>");
	CalWindow.document.writeln("<META NAME='Author' CONTENT='Infonautics GmbH, Switzerland'>");
	CalWindow.document.writeln("<META NAME='Email' CONTENT='infonautics@infonautics.ch'>");
	CalWindow.document.writeln("<LINK REL='stylesheet' TYPE='text/css' HREF='public/calendarx.css'>");

	CalWindow.document.writeln("<SCRI"+"PT LANGUAGE='JavaScript' TYPE='text/javascript'>");
	CalWindow.document.writeln("s_feld='"+AntwortFeld+"';");
	CalWindow.document.writeln("function s_c(s_datum) {");
	CalWindow.document.writeln(" eval('self.opener.document.'+s_feld+'.value=s_datum;');");
	CalWindow.document.writeln(" self.opener.SetDisplay(self.opener.window);");
	CalWindow.document.writeln(" window.close();");
	CalWindow.document.writeln("}");
   CalWindow.document.writeln("</SCRI"+"PT>");

	CalWindow.document.writeln("</HEAD>");
	CalWindow.document.writeln("<BODY CLASS='calbody' ONLOAD='window.focus();document.images[\"progress\"].src = \"images/indent.gif\";'>");
	CalWindow.document.writeln("<B>" + CalTextEinleitung + "</B>&nbsp;&nbsp;&nbsp;<IMG NAME='progress' SRC='images/progress.gif'><P>");

	CalWindow.document.writeln("<TABLE  CLASS='caltab'>");
   //Tagenummern Titel
   CalWindow.document.write("<TR CLASS='caltext'><TD CLASS='calfett' NOWRAP>" + CalTextMonatTag + "</TD>");
   for (itag=1; itag<=31; itag++) {
      CalWindow.document.write("<TD>" + (itag<10?"0":"") + itag + "</TD>");
   }
   CalWindow.document.writeln("</TR>");
   //Monat pro Zeile, Tag pro Spalte
 	for (imonat=1; imonat<=12; imonat++) {
 	   var aktmonat = imonat - 1 + CalStart;
 	   var aktjahr = CalJahr;
 	   if (aktmonat > 12) {
         aktmonat = aktmonat - 12;
         aktjahr++;
      }
      CalWindow.document.write("<TR CLASS='caltext'>");
      CalWindow.document.write("<TD>" + CalMonths[aktmonat-1] + "&nbsp;" + aktjahr + "</TD>");
      for (itag=1; itag<=31; itag++) {
         var CalIndex = (imonat-1)*31+itag-1;
         var CalDatum = new Date(aktjahr,aktmonat-1,itag);
         var CalWoTag = CalDays[CalDatum.getDay()];
         var CalTemp = CalWoTag==CalDays[0] ? CalWoTag : " ";
         if (CalArray[CalIndex] == "1") CalWindow.document.write("<TD CLASS='cal1' TITLE='" + CalWoTag + " " + itag + "." + aktmonat + "." + aktjahr + "' " +
            "onClick=\"s_c('" + aktmonat + "/" + itag + "/" + aktjahr + "')\">" + CalTemp + "</TD>");
         else if (CalArray[CalIndex] == "0") CalWindow.document.write("<TD CLASS='cal0'>" + CalTemp + "</TD>");
         else CalWindow.document.write("<TD CLASS='calx'> </TD>");
      }
      CalWindow.document.writeln("</TR>");
 	}
	CalWindow.document.writeln("</TABLE>");

	CalWindow.document.writeln("<BR><DIV ALIGN=LEFT><FONT CLASS='caltext1'>&nbsp;" + CalTextZimmer1 + "&nbsp;</FONT> &nbsp; <FONT CLASS='caltext0'>&nbsp;" + CalTextZimmer0 + "&nbsp;</FONT><BR></DIV>");
	CalWindow.document.writeln("</BODY></HTML>");
	CalWindow.document.close();
}


