<?

		$defaultday="#dddddd";
		$saturday="#bbbbbb";
		$sunday="#aaaaaa";

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

	<head>
		<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
		<meta name="generator" content="Adobe GoLive">
		<title>Kulturb&uuml;roRiehen</title>
		<link href="font2.css" rel="stylesheet" type="text/css" media="all">
	</head>
	<style>	
		body   {color: white; font-size: 12px; font-family: Verdana, Arial, Helvetica, sans-serif; text-align: center; padding: 0; border: 0; spacing: 0px; text-color: white }
    </style>
   
  
    <!-- selected nav  -->
    <script>var aktuellesMenu="veranstaltungen";</script>
    <!-- preload & scripts -->
	<? include('include/javascripts.txt') ?>    
    
    
    
	<body bgcolor="#ffffff">
	<center>
		<div id='containerSpace'>
			<div id='containerContent'>
				<!-- logo -->
				<? include("include/header2.txt") ?>
					<!-- navigation -->
<!--					<? include('include/navigation2.txt') ?> -->
					<!-- topline -->
				<div>
					<!-- spacer -->
					<div id='containerContentSideSpacer'>
					
						
							<!-- content -->
							<div id='containerContentSite'>
								
								<!-- navigation -->
		<?
			include("library/include.php");
		?>
		
		<?
		$sql = "SELECT * FROM  basis";
		$result = mysql_query($sql, $conn);
		if($result)
		{
				// riehen
				// evkalenderriehenpdf
				$evkalenderriehentext=mysql_result($result,0,"evkalenderriehentext");
				$evkalenderriehenlinktext=mysql_result($result,0,"evkalenderriehenlinktext");
				$evkalenderriehenlink=mysql_result($result,0,"evkalenderriehenlink");

				$evkalenderriehenpdflinktext=mysql_result($result,0,"evkalenderriehenpdflinktext");			
				$evkalenderriehenpdf=mysql_result($result,0,"evkalenderriehenpdf");
				
				$khblpic2=mysql_result($result,0,"khblpic2");
				
				//linebreaks umwandeln
				$evkalenderriehentext=displayText($evkalenderriehentext);
			
			
		}
		else
		{
			echo "<p>".mysql_error($conn);
		}
		?>
				<div id="contentTitle">Jahresagenda Veranstaltungen in Riehen</div><br><br>
	
	<table width="83%" valigh="top">
		<tr>
			<td align="left">
<!--			<a href='http://www.kulturbuero-riehen.ch/?a=1&t=0&y=3001&r=0&n=122&i=&c=25&v=page4&o=&s=' style='color: #888888'><<< zur&uuml;ck zur Übersicht</a>			 -->
	  <div  class='newwebsite'>Melden Sie Ihre Veranstaltung
					
			              
		            <script language="JavaScript" type="text/javascript">
		mailTowards = "mailto:"; atSign = "@"; period = ".";
		
		user0 = "kulturbuero-frey"; domain = "bluewin"; extension = "ch"
		
		eMail = mailTowards + user0 + atSign + domain + period + extension;
		dispeMail = "[ hier ]";
		
		function printEmail() {
		for (i=0; i<document.anchors.length; i++) {
		if (document.anchors[i].name == "email") {
		document.anchors[i].href = eMail;
		}
		}
		document.write(dispeMail);
		}
		            </script>
                    <a name="email" href="email.html">
                    <script language="JavaScript" type="text/javascript">printEmail();</script>
                    </a>
			  </div>

		</td>
			
			<td align="right">
		</td>	
		</tr>
	</table>

                    <style>
				#calendar{  border: 1px dotted white; } 
			    #year { font-size: 13px; border-bottom: 1px solid white; padding-top: 20px; color: #888888; }
			    #month { font-size: 12px;  padding-top: 10px; padding-left: 5px; color: #888888 }
			    #month a { font-size: 12px;  padding-top: 10px; padding-left: 5px; color: #888888 }
			    #date { font-size: 12px;  padding-top: 10px; padding-left: 20px;  }

			    #results { padding-bottom: 30px; }			    
				    #selecteplace { border-bottom: 1px solid white; padding: 0px; color: #888888}
				    #selecteddate { border: 1px solid white; font-weight: bold; display: inline; background: #999999 }
				    #date { padding-left: 10px; padding-right: 10px; display:inline; }
				    #datemonth { padding-left: 5px; padding-right: 5px; display:inline; }
				    #dateDateDisplay { padding-left: 2px; padding-right: 2px; display:inline; }
	
				    #displayYearContainer { border-bottom:  1px solid white; padding-bottom: 5px; }
				    #displayMonthContainer { border-bottom:  1px solid white;  padding-bottom: 5px; }
				    #displayDateContainer { border-bottom:  1px solid white; padding-bottom: 5px;  }
		
		            </style>
		
		
                  <!-- kalender --> 
                  <br>
                  <br>
                  <br>
		        </div>
				<div id='calendar'>
				          <div align="justify">
				            <?
			$todayYear=date('Y');
			$todayMonth=date('m');
			$todayDate=date('d');

			$selectedYear=-1;
			$selectedMonth=-1;
			$selectedDate=-1;
			$category="";
			$selectedCategory="";
						
			$somethingSelected=false;
			
			if (isset($_REQUEST["year"]))
			{
				$selectedYear=$_REQUEST["year"];
				$somethingSelected=true;
			}
			else
			$selectedYear=$todayYear;
			
			if (isset($_REQUEST["month"]))
			{
				$selectedMonth=$_REQUEST["month"];
				$somethingSelected=true;
			}
			
			if (isset($_REQUEST["date"]))
			{
				$selectedDate=$_REQUEST["date"];
				$somethingSelected=true;
			}
			
			if ($somethingSelected==false)
			{
				$selectedYear=$todayYear;
				$selectedMonth=$todayMonth;
				// $selectedDate=$todayDate;
				// $selectedMonth=-1;
				$selectedDate=-1;
				
				$somethingSelected=true;
			}
			
			// placeref
			$selectedplaceref=-1;
			if (isset($_REQUEST["placeref"]))
			{
				$selectedplaceref=intval($_REQUEST["placeref"]);
			}

			// category
			if (isset($_REQUEST["category"]))
			{
				$category=$_REQUEST["category"];
				$somethingSelected=true;
				$selectedCategory=$category;
			}
			
			// view
			$selectedView="all";
			if (isset($_REQUEST["view"]))
			{
				$category=$_REQUEST["view"];
				$somethingSelected=true;
			}


			// search
			$search="";
			if (isset($_REQUEST["search"]))
			{
				$search=$_REQUEST["search"];
			}

		
					// year
					echo("<div id='displayYearContainer'> ");
					for ($i=date('Y');$i<2015;$i++)
					{
						echo("<div id='date'> ");
						if ($selectedYear==$i) { echo("<div id='selecteddate'>"); }

						 if ($selectedYear==$i)  echo(" <a href='veranstaltungen_overview.php?year=$i&placeref=$selectedplaceref&category=$category' style='color: #ffffff'>$i</a>");	
						else echo(" <a href='veranstaltungen_overview.php?year=$i&placeref=$selectedplaceref&category=$category' style='color: #666666'>$i</a>");	

						if ($selectedYear==$i) { echo("</div>"); }
						echo("</div> ");
					}
					
					// echo("<div style='align: right;display:inline;border: 1px solid white; background:#aaaaaa; padding: 0px; padding-right: 10px; padding-left:10px;'><a href='veranstaltungen_overview.php'>F&uuml;r Veranstalter >>></a></div>");
					echo("</div> ");
										
					// month display
					echo("\n<!-- <div id='displayMonthContainer'> ");
					if ($selectedYear!=-1)
					{
						echo("<div> ");
						for ($i=1;$i<13;$i++)
						{
							echo("<div id='datemonth'> ");
							if ($selectedMonth==$i) { echo("<div id='selecteddate'>"); }
							$monthName=NameOfMonth($i);
							echo(" <a href='veranstaltungen_overview.php?year=$selectedYear&month=$i&placeref=$selectedplaceref&category=$category'>$monthName</a>");	
							if ($selectedMonth==$i) { echo("</div>"); }
							echo("</div> ");
						}
						echo("</div> ");
					}
					echo("</div> -->");

/*					
					// date display
					echo("<div id='displayDateContainer'> ");
					if ($selectedMonth!=-1)
					{
						$daysdefault=31;
						
						// generate time in php
						$timestamp=mktime(12,00,00,$selectedMonth,1,$selectedYear);
						//echo(date("Y m d ",$timestamp));
						$daysdefault=intval(date("t",$timestamp));
						
						echo("<div> ");
						for ($i=1;$i<($daysdefault+1);$i++)
						{
							echo("<div id='dateDateDisplay'>");
							if ($selectedDate==$i) { echo("<div id='selecteddate'>"); }
							echo(" <a href='veranstaltungen_overview.php?year=$selectedYear&month=$selectedMonth&date=$i&placeref=$selectedplaceref&category=$category'>$i</a>");	
							if ($selectedDate==$i) { echo("</div>"); }
							echo("</div>");
						}
						echo("</div> ");
					}
					echo("</div> ");
					
*/		
					
					// ------------------------------------
					// display all places & categories
					// ------------------------------------
					// echo("<div id='selecteplace'>");
					echo("<form name='placerefform' style='padding: 0px; border:0px; border-bottom: 1px solid white;'>");
		
						echo("<input type=hidden name='year' value='$selectedYear'>");
						echo("<input type=hidden name='month' value='$selectedMonth'>");
						echo("<input type=hidden name='date' value='$selectedDate'>");
						
						// konzert / veranstaltung				
						echo(" Kategorie: ");
						echo("<select name='category' onChange='document.placerefform.submit();'>");
							echo("<option value='' ");
							if ($category=="") echo(" selected ");
							echo(" >Alle</option>");
							echo("<option value='Konzert'");
							if ($category=="Konzert") echo(" selected ");
							echo(">Konzert</option>");
							echo("<option value='Veranstaltung'");
							if ($category=="Veranstaltung") echo(" selected ");
							echo(">Veranstaltung</option>");
						echo("</select>");
		
						
						// placeref
						echo(" Ort der Veranstaltung: ");
						echo("<select name='placeref' onChange='document.placerefform.submit();'>");
						echo("<option value=-1>Alle Anzeigen</option>");
						$queryPlace = "SELECT * FROM kalenderplace order by name ";
						$resultPlace = mysql_query($queryPlace, $conn);
						if($resultPlace)
						{
							$numberRecords = mysql_num_rows($resultPlace);
							
							if ($numberRecords>0)
							{
								for ($it=0;$it<$numberRecords;++$it)
								{
									$placeId=mysql_result($resultPlace,$it,"id");
									$placeName=mysql_result($resultPlace,$it,"name");
									echo("<option value=");
									echo($placeId);
									if ($selectedplaceref==$placeId) { echo("  selected ");}
									echo(">");
									echo($placeName);
									echo("</option>");
								}
							}
						}
						echo("</select>");
		
		
					echo("</form>");
					// echo("</div>");
					
					// search
/*
					echo("<div style='border-top: 1px solid white;border-bottom: 1px solid white; display:inline;' align=right>");
						echo("<form style='border: 0px; padding: 0px;' action='veranstaltungen_overview.php'>Oder Volltextsuche: <input type=text name='search' value='$search' style='border: 0px; padding: 0px;' ><input type=submit value='Suchen' style='border: 0px; padding: 0px;' ></form>");
					echo("</div>");
*/

			// --------------------------------
			// selection
			// --------------------------------
   			if ($search=="")
	   		{	
	   		
					// -----------------------------
					// display results
					// -----------------------------
					$placesearch="";
					if ($selectedplaceref!=-1) $placesearch=" AND placeref=$selectedplaceref  ";
					$categorysearch="";
					if ($category!="") $placesearch=" AND category='$category'  ";
					
					// year ?
					$yearcondition=" (Year(datebeg)=$selectedYear OR Year(dateend)=$selectedYear)";

					// display
					echo("<div id='results'>");
					
					// WHERE Now()<=datebeg OR Now()<=dateend 
					
					// default ..
					if (!$somethingSelected) $sql = "SELECT * FROM kalendar WHERE  $yearcondition  order by datebeg asc,time asc";
					
					// normal
					if ($somethingSelected) $sql = "SELECT * FROM  kalendar WHERE $yearcondition $monthcondition $datecondition $placesearch $selectNow order by datebeg asc,time asc";
					
					// echo("<pre>".str_replace("<","&lt;",$sql)."</pre>");
					
					$result = mysql_query($sql, $conn);
					if($result)
					{
						$number = mysql_num_rows($result);
						
						// if ($number>0)
						{
								// ------------------------------------------------------------
								// store results into array so we can look through it
								// ------------------------------------------------------------
								$dateArray=array();
								$dateArrayIndex=array();
								for ($it=0;$it<$number;++$it)
								{
									$datebeg=mysql_result($result,$it,"datebeg");
									$dateTimestamp=mktime(12,0,0,intval(substr($datebeg,5,7)),intval(substr($datebeg,8,10)),intval(substr($datebeg,0,4)));
									
									$dateend=mysql_result($result,$it,"dateend");
									$dateEndTimestamp=mktime(12,0,0,intval(substr($dateend,5,7)),intval(substr($dateend,8,10)),intval(substr($dateend,0,4)));
									
									if (($dateTimestamp<$dateEndTimestamp) || ($dateTimestamp==$dateEndTimestamp))
									{
										// echo("<br>***$datebeg-$dateend");
										
										$counter=0;
										do
										{
												$dateTempTimestamp=mktime(12,0,0,intval(substr($datebeg,5,7)),intval(substr($datebeg,8,10))+$counter,intval(substr($datebeg,0,4)));
									
												$dateArray[count($dateArray)]=$dateTempTimestamp;
												$dateArrayIndex[count($dateArrayIndex)]=$it;
												
												// echo("<br>- ".$counter." ".date("Y m d ",$dateTempTimestamp));
												
												$counter++;
												if ($counter>365) break;
										}
										while (($dateTempTimestamp<$dateEndTimestamp));
									
									}
									else
									if ($dateTimestamp>$dateEndTimestamp)
									{
										// just take as one day 
										// echo("<br>$datebeg-$dateend");
										$dateArray[count($dateArray)]=$datebeg;
										$dateArrayIndex[count($dateArrayIndex)]=$it;
									}
									
									// display dates
									
									
								}
						
								// year
								$stryear="";
								$stryear=$stryear."<table border=0>"; // start table
								// what was selected ?
								//
								// calendar
								$stryearcalendar="<table border=0><tr><td valign=top>";
								
								// selected year
								if ($selectedYear!=-1)
								{
									$stryear=$stryear."<tr><td valign=top colspan=7 width=700><div id='year'>$selectedYear</div></td></tr>";
									
									$monthCounter=0;
									
									// month
									for ($month=1;$month<13;$month++)
									{	
										
										// if (($selectedMonth==-1) || ($selectedMonth==$month))
										{
									
												// timestamp
												$timestamp=mktime(12,00,00,$month,1,$selectedYear);
												//echo(date("Y m d ",$timestamp));
												$daysdefault=intval(date("t",$timestamp));
												
												
												$strmonth="";
																								
												$monthName=NameOfMonth($month);
												if (($selectedMonth==-1) || ($selectedMonth==$month))
													$strmonth=$strmonth."<tr><td valign=top colspan=7><div id='month' style='bottom-border: 1px solid black;'><a name='$monthName'>$monthName</a></div></td></tr>";
												
												// --------------------------
												// calendar display
												// --------------------------
												// find first day 
												$strmonthcalendar="";
												
													
													$strmonthcalendar=$strmonthcalendar."<table border=0 ";
													
													// if ($selectedMonth==$month) { $strmonthcalendar=$strmonthcalendar." bgcolor=#440000"; }
													if ($selectedMonth==$month) { $strmonthcalendar=$strmonthcalendar." style='border: 1px solid #999999' "; }
													
													// default - jump down
													/*
													$href="<a href='#$monthName'>";
													// if (($selectedMonth==-1) || ($selectedMonth!=$month)) 
													if ($selectedMonth==-1)
													{  
														$href="<a href='veranstaltungen_overview.php?year=$selectedYear&month=$month&placeref=$placeref&category=$category#$monthName'>";
													}													
													$href="<a href='veranstaltungen_overview.php?year=$selectedYear&month=$month&placeref=$placeref&category=$category#$monthName'>";
													*/
													$href="<a href='veranstaltungen_overview.php?year=$selectedYear&month=$month&placeref=".$selectedplaceref."&category=".$selectedcategory."#$monthName' class='newwebsite'>";
													
													$strmonthcalendar=$strmonthcalendar.">";
													$strmonthcalendar=$strmonthcalendar." <tr>";
													$strmonthcalendar=$strmonthcalendar."  <td valign=top colspan=7>".$href.$monthName."</a></td>";
													$strmonthcalendar=$strmonthcalendar." </tr>";
													$strmonthcalendar=$strmonthcalendar." <tr bgcolor=#777777>";
														$strmonthcalendar=$strmonthcalendar."  <td valign=top>Mo</td>";
														$strmonthcalendar=$strmonthcalendar."  <td valign=top>Di</td>";
														$strmonthcalendar=$strmonthcalendar."  <td valign=top>Mi</td>";
														$strmonthcalendar=$strmonthcalendar."  <td valign=top>Do</td>";
														$strmonthcalendar=$strmonthcalendar."  <td valign=top>Fr</td>";
														$strmonthcalendar=$strmonthcalendar."  <td valign=top>Sa</td>";
														$strmonthcalendar=$strmonthcalendar."  <td valign=top>So</td>";
													$strmonthcalendar=$strmonthcalendar." </tr>";
													
													
													// fill the calendars
													$start=date('w',$timestamp);
													if ($start==0) $start=6;
													else $start=$start-1;
													$strmonthcalendar=$strmonthcalendar."<tr>";
													for ($t=0;$t<$start;$t++)
													{
														$strmonthcalendar=$strmonthcalendar."<td></td>";
													}
													
													
												// echo($strmonthcalendar);
												
												// --------------------------
												// default display
												// --------------------------
												// datetmp
												$datetmp=-1;
												
												// found
												$foundMonth=false;
												for ($datex=1;$datex<($daysdefault+1);$datex++)
												{
													
													$timestamp=mktime(12,00,00,$month,$datex,$selectedYear);
													
													$foundDates=0;
													
													// datex
													// if (($selectedDate==-1)||($selectedDate==$datex))
													{
															// ok check if there is something 
															// go through the array
															$foundEventForThisDate=false;
															$strdate="";
															for ($dat=0;$dat<count($dateArray);$dat++)
															{
																$ts=$dateArray[$dat];
																
																if ($ts==$timestamp)
																{
																		$foundMonth=true;
																		
																		$foundDates++;
																		
																		$foundEventForThisDate=true;
			
																		$index=$dateArrayIndex[$dat];															
																		
																		$modid=mysql_result($result,$index,"id");
																		$category=mysql_result($result,$index,"category");
																		$title=mysql_result($result,$index,"title");
																		$place=mysql_result($result,$index,"place");
																		$datebeg=mysql_result($result,$index,"datebeg");
																		$dateend=mysql_result($result,$index,"dateend");
																		$placeref=mysql_result($result,$index,"placeref");
																		$time=mysql_result($result,$index,"time");
																		$timeend=mysql_result($result,$index,"timeend");
																		$url=mysql_result($result,$index,"url");
																		
																		
																			// placeref
																			$query = "SELECT * FROM kalenderplace WHERE id=$placeref; ";
																			$resultPlace = mysql_query($query, $conn);
																			if($resultPlace)
																			{
																				$numberRecords = mysql_num_rows($resultPlace);
																				
																				if ($numberRecords>0)
																				{
																					$placeId=mysql_result($resultPlace,0,"id");
																					$placeName=mysql_result($resultPlace,0,"name");
																					
																					
																				}
																			}
																		
																		// $datebeg - 2007-03-24
																		$arr=explode("-",$datebeg); // $arr[0]=2007
																		$year=$arr[0];
																		$montht=intval($arr[1]);
																		$date_day=intval($arr[2]);
																		$monthName=NameOfMonth($montht);
																		
																		$arr=explode("-",$dateend); // $arr[0]=2007
																		$yearStop=$arr[0];
																		$monthStop=intval($arr[1]);
																		$date_dayStop=intval($arr[2]);
																		$monthNameStop=NameOfMonth($monthStop);
																		
																		
																		$strdate=$strdate."<tr";
																		$selectedDateX="";
																		if ($selectedDate==$datex) 
																		{
																			$strdate=$strdate." bgcolor=#555500   ";
																			$selectedDateX=" style='color: #ffffff;' "; 
																		}
																		else
																		{
																			if (intval(date("w",$timestamp))==6) $strdate=$strdate." bgcolor=$saturday ";
																			else
																			if (intval(date("w",$timestamp))==0) $strdate=$strdate." bgcolor=$sunday ";
																			else
																			 $strdate=$strdate." bgcolor=$defaultday ";
																		}
																		
																		$strdate=$strdate.">"; // start with the line
																		
																		$strdate=$strdate."<td valign=top align=right>";
																		$strdate=$strdate."<div id='date'  class='newwebsitetext'  $selectedDateX >";	
																			if ($datetmp!=$datex)
																			{
																				$strdate=$strdate." $datex  "; // $monthName
																				$datetmp=$datex;
																			}
																		$strdate=$strdate."<a name='".$monthName.$datex."'>&nbsp;</a></div>";						
																		$strdate=$strdate."</td>";						
												
												
																		$strdate=$strdate."<td valign=top>";
																		$strdate=$strdate."<div  class='newwebsitetext' $selectedDateX>";						
																				if (($url!="")&&($url!="http")) $strdate=$strdate."<a href='$url' target='_blank' $selectedDateX>";
																				$strdate=$strdate."$title";
																				$strdate=$strdate." ($category) ";
																				if (($url!="")&&($url!="http")) $strdate=$strdate."</a>";
																				
																				// stop
																				//if (($yearStop!=$year)&&($monthName!=$monthNameStop)&&($date_dayStop!=$date_day))
																				if ($datebeg!=$dateend)
																				{
																					$strdate=$strdate." ".$date_day.". ".$monthName." ";
																					$strdate=$strdate."- ".$date_dayStop.". ".$monthNameStop." ";
																					// if ($year!=$yearStop) $strdate=$strdate.$yearStop;
																					$strdate=$strdate." ".$yearStop;
																				}																					
																				
																		$strdate=$strdate."</div>";						
																		$strdate=$strdate."</td>";						
												
																		$strdate=$strdate."<td valign=top>";
																		$strdate=$strdate."<div  class='newwebsitetext' $selectedDateX>";						
																				$strdate=$strdate."$placeName";
																		$strdate=$strdate."</div>";						
																		$strdate=$strdate."</td>";						
																		
																		// string manipulation
																		// "12:13:15"
																		$time=substr($time,0,5);
																		$strdate=$strdate."<td valign=top>";
																		$strdate=$strdate."<div id='date'  class='newwebsitetext' $selectedDateX>";						
																		$strdate=$strdate."$time";
																		$strdate=$strdate."</div>";						
																		$strdate=$strdate."</td>";						
																		
																		$timeend=substr($timeend,0,5);
																		$strdate=$strdate."<td valign=top>";
																		$strdate=$strdate."<div id='date'  class='newwebsitetext' $selectedDateX>";						
																		$strdate=$strdate."$timeend";
																		$strdate=$strdate."</div>";						
																		$strdate=$strdate."</td>";
																		
																		$strdate=$strdate."</tr>"; // end of line
																	
																}
															}
															
															if ($foundEventForThisDate==false)
															{
																	$strdate=$strdate."<tr";
																	$selectedDateX="";
																		if ($selectedDate==$datex) 
																		{
																			$strdate=$strdate." bgcolor=#555500  ";
																			$selectedDateX=" style='color: #fffffff' "; 
																		}
																		else
																		{
																			if (intval(date("w",$timestamp))==6) $strdate=$strdate." bgcolor=$saturday ";
																			else
																			if (intval(date("w",$timestamp))==0) $strdate=$strdate." bgcolor=$sunday ";
																			else
																			 $strdate=$strdate." bgcolor=$defaultday ";
																		}
																		$strdate=$strdate.">"; // start with the line
													
																		$strdate=$strdate."<td valign=top align=right width=40>";
																		$strdate=$strdate."<div id='date'  class='newwebsitetext' $selectedDateX >";	
																			if ($datetmp!=$datex)
																			{
																				$strdate=$strdate." $datex <a name='".$monthName.$datex."'>&nbsp;</a> "; // $monthName
																				$datetmp=$datex;
																			}
																		$strdate=$strdate."</div>";						
																		$strdate=$strdate."</td>";
																		$strdate=$strdate."<td style='border-bottom: 1px solid white;'>&nbsp;</td>";
																		$strdate=$strdate."<td style='border-bottom: 1px solid white;'>&nbsp;</td>";
																		$strdate=$strdate."<td style='border-bottom: 1px solid white;'>&nbsp;</td>";
																		$strdate=$strdate."<td style='border-bottom: 1px solid white;'>&nbsp;</td>";
																		
																	$strdate=$strdate."</tr>";
																	
																	
															}
															
															// strmonth
															if (($selectedMonth==-1) || ($selectedMonth==$month))
															{
																$strmonth=$strmonth.$strdate;
															}
															
															// -------------------------
															// calendar display top
															// -------------------------
															$strmonthcalendar=$strmonthcalendar."<td align=right valign=top ";
															
															if  ($selectedMonth==$month)
															if ($selectedDate==$datex) { $strmonthcalendar=$strmonthcalendar." style='border: 1px solid white;' "; } 
															
															if ($foundDates>0) 
															{	
																if ($foundDates<2) $strmonthcalendar=$strmonthcalendar." bgcolor=#663333  "; // style='border: 1px solid  white'
																else
																$strmonthcalendar=$strmonthcalendar." bgcolor=#883333  "; // style='border: 1px solid  white'
															
															}
															else $strmonthcalendar=$strmonthcalendar." bgcolor=#224422  "; // style='border: 1px solid  white'
															
															
															$datext=round($datex/6)*6;
															if ($datext%6==0) $datext=$datext-6;
															if ($datext<1) $datext=1;
															$anchor="#$monthName$datext";
															
															if ($datext<5) $anchor="#$monthName";
															
															// if  ($selectedMonth!=$month)
															  $href="<a href='veranstaltungen_overview.php?year=$selectedYear&month=$month&date=$datex&placeref=$selectedplaceref&category=$selectedcategory$anchor' class='newwebsitehref'>";
															// else
															//   $href="<a href='$anchor'>";
															
															$strmonthcalendar=$strmonthcalendar." class='whitenewwebsitetext'><center class='whitenewwebsitetext' style='color: white;'>$href$datex</a></center></td>";
															if (intval(date("w",$timestamp))==0) $strmonthcalendar=$strmonthcalendar."</tr><tr>";
														}
																									
													
														
													
												}  // dates
												
												// calendar
												$strmonthcalendar=$strmonthcalendar."</tr>";	
												$strmonthcalendar=$strmonthcalendar."</table>";
												$stryearcalendar=$stryearcalendar."\n".$strmonthcalendar;
												// $stryearcalendar=$stryearcalendar."\ntest";
												
												if (($monthCounter+1)%4==0) $stryearcalendar=$stryearcalendar."</td></tr><tr><td valign=top>";
												else 
												$stryearcalendar=$stryearcalendar."</td><td valign=top>";
												
												// normal
												$stryear=$stryear.$strmonth;
												
												$monthCounter++;
										}
										
										
										
											
									}
								
								}
								$stryear=$stryear."</table>";
								
								
								// -----------------------
								// output
								// -----------------------
								// calendar
								$stryearcalendar=$stryearcalendar."</td></tr></table>";
								echo($stryearcalendar);
								// normal display
							    echo($stryear);
								
							
					   }
					   
					   // ...
					 }
					echo("</div>"); 
			} 
			
		?>
	                      </div>
				  </div>
				<div align="justify"><br>
				  <br>
				  <br>
				  <br>
				  <br>
				  <br>
				  <br>
				  <br>
				  <br>
				  <!-- footer -->
				  <? include('include/footer.txt') ?>
				  </div>
							</div>
				
				</div>
					
			</div>
		</div>
	</center>	
	</body>

</html>

<?
  function NameOfMonth($month)
  {
	  $monthName="";
	  
		if ($month==1) $monthName="Januar";
		if ($month==2) $monthName="Februar";
		if ($month==3) $monthName="M&auml;rz";
		if ($month==4) $monthName="April";
		if ($month==5) $monthName="Mai";	  
	 	if ($month==6) $monthName="Juni";
	 	if ($month==7) $monthName="Juli";
	 	if ($month==8) $monthName="August";
	 	if ($month==9) $monthName="September";
	 	if ($month==10) $monthName="Oktober";
	 	if ($month==11) $monthName="November";
	 	if ($month==12) $monthName="Dezember";

	return $monthName; 
  }


?>