<?php
/*
This file is part of Thomas Bley's moregroupware webmail2/calendar2/admin2 module. (tb-mgw)

More information:
-----------------

Simple Groupware Solutions Thomas Bley
Fichtenstr. 23
Germany, 85640 Putzbrunn

Contact:
--------

info@simple-groupware.de

http://www.simple-groupware.de


Copyright 2002-2003 Thomas Bley
tb-mgw is distributed under the terms of the GNU General Public License 

tb-mgw is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

tb-mgw is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with tb-mgw; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

// Sidebar
// Moregroupware.org

$fake_getdate_time = strtotime2($this_year.'-'.$this_month.'-15');

?>
	
	<table cellpadding="0" cellspacing="0" border="0" width="170">
		<tr>
			<td valign="middle" align="center">
				<table width="170" border="0" cellpadding="0" cellspacing="0" class="calborder">
					<tr>

						<td align="left" valign="top" width="1" class="sideback"><img src="templates/default/media/spacer.gif" width="1" height="20" alt=" "></td>
						<td align="center" class="sideback"><font class="G10BOLD"><?php print (localizeDate ($hashmap["dateFormat_month"], strtotime2("-1 month", $fake_getdate_time))); ?></font></td>
						<td align="right" valign="top" width="1" class="sideback"></td>
					</tr>
					<tr>
						<td colspan="3" bgcolor="#FFFFFF" align="center">
							<table border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
								<tr>
									<td><img src="templates/default/media/spacer.gif" width="21" height="3" alt=" "></td>
									<td><img src="templates/default/media/spacer.gif" width="21" height="3" alt=" "></td>
									<td><img src="templates/default/media/spacer.gif" width="21" height="1" alt=" "></td>
									<td><img src="templates/default/media/spacer.gif" width="21" height="1" alt=" "></td>
									<td><img src="templates/default/media/spacer.gif" width="21" height="1" alt=" "></td>
									<td><img src="templates/default/media/spacer.gif" width="21" height="1" alt=" "></td>
									<td><img src="templates/default/media/spacer.gif" width="21" height="1" alt=" "></td>
									<td><img src="templates/default/media/spacer.gif" width="21" height="1" alt=" "></td>
								</tr>
								<tr><td></td>
								<?php
									$start_day = strtotime2($week_start_day);
									for ($i=0; $i<7; $i++) {
										$day_num = date("w", $start_day);
										$day = $daysofweekreallyshort_lang[$day_num];
										print "<td align=\"center\" class=\"G10BOLD\">$day</td>\n";
										$start_day = strtotime2("+1 day", $start_day); 
									}
								?>
								</tr>
								<tr height="3">
									<td colspan="8"><img src="templates/default/media/spacer.gif" width="1" height="3" alt=" "></td>
								</tr>
								<?php
									$minical_time = strtotime2("-1 month", $fake_getdate_time);
									$minical_month = date("m", $minical_time);
									$minical_year = date("Y", $minical_time);
									
									$first_of_month = $minical_year.$minical_month."01";
									$start_day = strtotime2(dateOfWeek($first_of_month, $week_start_day));
									$i = 0;
									$whole_month = TRUE;
									$num_of_events = 0;
                                    
									do {
										$day = date ("j", $start_day);
                                        $day2 = date ("d", $start_day);
										$minical_week = date("W", $start_day);
                                        
										$style = "";
										if ($minical_week==$today_week) {
										  $style='style="background-color: #C0FFC0"';
										}
										if ($minical_week==$this_week) {
										  $style='style="background-color: #C0C0FF"';
										}
									
                                        $theclass = "psf";
                                        if ($today_day == $day and $today_month == $minical_month and $today_year == $minical_year) {
                                          $theclass = "psf2";
                                        }

										$daylink = date ("Ymd", $start_day);
										$check_month = date ("m", $start_day);
										if ($check_month != $minical_month) $day= "<font class=\"G10G\">$day</font>";
										if ($i == 0) echo "<tr ".$style."><td align='center'><a href='week.php?cal=".$cal."&getdate=".$daylink."&".SID."' class='psf'><font class='V9G'>".date ("W", $start_day)."</font></a></td>\n";
										if (isset($master_array[("$daylink")]) && ($check_month == $minical_month)) {
											echo "<td align=\"center\" class=\"G10B\">\n";
											echo "<a class=\"".$theclass."\" href=\"day.php?cal=$cal&getdate=$daylink&".SID."\" style=\"font-weight: bold; color: ".($theclass?"":"#00C000")."\">$day</a>\n";
											echo "</td>\n";
										} else {
											echo "<td align=\"center\" class=\"G10B\">\n";
											echo "<a class=\"".$theclass."\" href=\"day.php?cal=$cal&getdate=$daylink&".SID."\">$day</a>\n";
											echo "</td>\n";
										}
										$start_day = strtotime2("+1 day", $start_day); 
										$i++;
										if ($i == 7) { 
											echo "</tr>\n";
											$i = 0;
											$checkagain = date ("m", $start_day);
											if ($checkagain != $minical_month) $whole_month = FALSE;	
										}
									} while ($whole_month == TRUE);
								?>
							</table>
						</td>
					</tr>
					<tr>
						<td colspan="3" bgcolor="#FFFFFF"><img src="templates/default/media/spacer.gif" width="148" height="6" alt=" "></td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
	<br>
	<table cellpadding="0" cellspacing="0" border="0" width="170">
		<tr>
			<td valign="middle" align="center">
				<table width="170" border="0" cellpadding="0" cellspacing="0" class="calborder">
					<tr>
						<td align="left" valign="top" width="1" class="sideback"><img src="templates/default/media/spacer.gif" width="1" height="20" alt=" "></td>
						<td align="center" class="sideback"><font class="G10BOLD"><?php print (localizeDate ($hashmap["dateFormat_month"], strtotime2($getdate))); ?></font></td>
						<td align="right" valign="top" width="1" class="sideback"></td>
					</tr>
					<tr>
						<td colspan="3" bgcolor="#FFFFFF" align="center">
							<table border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
								<tr>
									<td><img src="templates/default/media/spacer.gif" width="21" height="3" alt=" "></td>
									<td><img src="templates/default/media/spacer.gif" width="21" height="3" alt=" "></td>
									<td><img src="templates/default/media/spacer.gif" width="21" height="1" alt=" "></td>
									<td><img src="templates/default/media/spacer.gif" width="21" height="1" alt=" "></td>
									<td><img src="templates/default/media/spacer.gif" width="21" height="1" alt=" "></td>
									<td><img src="templates/default/media/spacer.gif" width="21" height="1" alt=" "></td>
									<td><img src="templates/default/media/spacer.gif" width="21" height="1" alt=" "></td>
									<td><img src="templates/default/media/spacer.gif" width="21" height="1" alt=" "></td>
								</tr>
								<tr><td></td>
								<?php
									$start_day = strtotime2($week_start_day);
									for ($i=0; $i<7; $i++) {
										$day_num = date("w", $start_day);
										$day = $daysofweekreallyshort_lang[$day_num];
										print "<td align=\"center\" class=\"G10BOLD\">$day</td>\n";
										$start_day = strtotime2("+1 day", $start_day); 
									}
								?>
								</tr>
								<tr height="3">
									<td colspan="8"><img src="templates/default/media/spacer.gif" width="1" height="3" alt=" "></td>
								</tr>
								<?php
									$minical_time = $fake_getdate_time;
									$minical_month = date("m", $minical_time);
									$minical_year = date("Y", $minical_time);
									$first_of_month = $minical_year.$minical_month."01";
									$start_day = strtotime2(dateOfWeek($first_of_month, $week_start_day));
									$i = 0;
									$whole_month = TRUE;
									$num_of_events = 0;
									do {
										$day = date ("j", $start_day);
										$day_month = date("m",$start_day);
										$day2 = date ("d", $start_day);
										$minical_week = date("W", $start_day);
                                        
										$style = "";
										if ($minical_week==$today_week) {
										  $style='style="background-color: #C0FFC0"';
										}
										if ($minical_week==$this_week) {
										  $style='style="background-color: #C0C0FF"';
										}
									
                                        $theclass = "psf";
                                        if ($today_day == $day and $today_month == $minical_month and $today_year == $minical_year) {
                                          $theclass = "psf2";
                                        }
                                        if ($this_day2 == $day and $this_month == $day_month and $this_year == $minical_year) {
                                          $theclass = "psf3";
                                        }

										$daylink = date ("Ymd", $start_day);
										$check_month = date ("m", $start_day);
										if ($check_month != $minical_month) $day= "<font class=\"G10G\">$day</font>";
										if ($i == 0) echo "<tr ".$style."><td align='center'><a href='week.php?cal=".$cal."&getdate=".$daylink."&".SID."' class='psf'><font class='V9G'>".date ("W", $start_day)."</font></a></td>\n";
										if (isset($master_array[("$daylink")]) && ($check_month == $minical_month)) {
											echo "<td align=\"center\" class=\"G10B\">\n";
											echo "<a class=\"".$theclass."\" href=\"day.php?cal=$cal&getdate=$daylink&".SID."\" style=\"font-weight: bold; color: ".($theclass?"":"#00C000")."\">$day</a>\n";
											echo "</td>\n";
										} else {
											echo "<td align=\"center\" class=\"G10B\">\n";
											echo "<a class=\"".$theclass."\" href=\"day.php?cal=$cal&getdate=$daylink&".SID."\">$day</a>\n";
											echo "</td>\n";
										}
										$start_day = strtotime2("+1 day", $start_day); 
										$i++;
										if ($i == 7) { 
											echo "</tr>\n";
											$i = 0;
											$checkagain = date ("m", $start_day);
											if ($checkagain != $minical_month) $whole_month = FALSE;	
										}
									} while ($whole_month == TRUE);
								?>
							</table>
						</td>
					</tr>
					<tr>
						<td colspan="3" bgcolor="#FFFFFF"><img src="templates/default/media/spacer.gif" width="148" height="6" alt=" "></td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
	<br>
	<table cellpadding="0" cellspacing="0" border="0" width="170">
		<tr>
			<td valign="middle" align="center">
				<table width="170" border="0" cellpadding="0" cellspacing="0" class="calborder">
					<tr>
						<td align="left" valign="top" width="1" class="sideback"><img src="templates/default/media/spacer.gif" width="1" height="20" alt=" "></td>
						<td align="center" class="sideback"><font class="G10BOLD"><?php print (localizeDate ($hashmap["dateFormat_month"], strtotime2("+1 month", strtotime2($getdate)))); ?></font></td>
						<td align="right" valign="top" width="1" class="sideback"></td>
					</tr>
					<tr>
						<td colspan="3" bgcolor="#FFFFFF" align="center">
							<table border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
								<tr>
									<td><img src="templates/default/media/spacer.gif" width="21" height="3" alt=" "></td>
									<td><img src="templates/default/media/spacer.gif" width="21" height="3" alt=" "></td>
									<td><img src="templates/default/media/spacer.gif" width="21" height="1" alt=" "></td>
									<td><img src="templates/default/media/spacer.gif" width="21" height="1" alt=" "></td>
									<td><img src="templates/default/media/spacer.gif" width="21" height="1" alt=" "></td>
									<td><img src="templates/default/media/spacer.gif" width="21" height="1" alt=" "></td>
									<td><img src="templates/default/media/spacer.gif" width="21" height="1" alt=" "></td>
									<td><img src="templates/default/media/spacer.gif" width="21" height="1" alt=" "></td>
								</tr>
								<tr><td></td>
								<?php
									$start_day = strtotime2($week_start_day);
									for ($i=0; $i<7; $i++) {
										$day_num = date("w", $start_day);
										$day = $daysofweekreallyshort_lang[$day_num];
										print "<td align=\"center\" class=\"G10BOLD\">$day</td>\n";
										$start_day = strtotime2("+1 day", $start_day); 
									}
								?>
								</tr>
								<tr height="3">
									<td colspan="8"><img src="templates/default/media/spacer.gif" width="1" height="3" alt=" "></td>
								</tr>
								<?php
									$minical_time = strtotime2("+1 month", $fake_getdate_time);
									$minical_month = date("m", $minical_time);
									$minical_year = date("Y", $minical_time);
									$first_of_month = $minical_year.$minical_month."01";
									$start_day = strtotime2(dateOfWeek($first_of_month, $week_start_day));
									$i = 0;
									$whole_month = TRUE;
									$num_of_events = 0;
									do {
										$day = date ("j", $start_day);
										$day2 = date ("d", $start_day);
										$minical_week = date("W", $start_day);
                                        
										$style = "";
										if ($minical_week==$today_week) {
										  $style='style="background-color: #C0FFC0"';
										}
										if ($minical_week==$this_week) {
										  $style='style="background-color: #C0C0FF"';
										}
									
                                        $theclass = "psf";
                                        if ($today_day == $day and $today_month == $minical_month and $today_year == $minical_year) {
                                          $theclass = "psf2";
                                        }

										$daylink = date ("Ymd", $start_day);
										$check_month = date ("m", $start_day);
										if ($check_month != $minical_month) $day= "<font class=\"G10G\">$day</font>";
										if ($i == 0) echo "<tr ".$style."><td align='center'><a href='week.php?cal=".$cal."&getdate=".$daylink."&".SID."' class='psf'><font class='V9G'>".date ("W", $start_day)."</font></a></td>\n";
										if (isset($master_array[("$daylink")]) && ($check_month == $minical_month)) {
											echo "<td align=\"center\" class=\"G10B\">\n";
											echo "<a class=\"".$theclass."\" href=\"day.php?cal=$cal&getdate=$daylink&".SID."\" style=\"font-weight: bold; color: ".($theclass?"":"#00C000")."\">$day</a>\n";
											echo "</td>\n";
										} else {
											echo "<td align=\"center\" class=\"G10B\">\n";
											echo "<a class=\"".$theclass."\" href=\"day.php?cal=$cal&getdate=$daylink&".SID."\">$day</a>\n";
											echo "</td>\n";
										}
										$start_day = strtotime2("+1 day", $start_day); 
										$i++;
										if ($i == 7) { 
											echo "</tr>\n";
											$i = 0;
											$checkagain = date ("m", $start_day);
											if ($checkagain != $minical_month) $whole_month = FALSE;	
										}
									} while ($whole_month == TRUE);
								?>
							</table>
						</td>
					</tr>
					<tr>
						<td colspan="3" bgcolor="#FFFFFF"><img src="templates/default/media/spacer.gif" width="148" height="6" alt=" "></td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
    <br>
<?php if (isset($master_array[($tomorrows_date)]) && sizeof($master_array[($tomorrows_date)]) > 0) { ?>
	<table cellpadding="0" cellspacing="0" border="0" width="170">
		<tr>
			<td valign="middle" align="center">
				<table width="170" border="0" cellpadding="0" cellspacing="0" class="calborder">
					<tr>
						<td align="left" valign="top" width="1%" class="sideback"><img src="templates/default/media/spacer.gif" width="1" height="20" alt=" "></td>
						<td align="center" width="98%" class="sideback"><font class="G10BOLD"><?php echo $hashmap["tomorrows_lang"]; ?></font></td>
						<td align="right" valign="top" width="1%" class="sideback"></td>
					</tr>
					<tr>
						<td colspan="3" bgcolor="#FFFFFF" align="center">
							<table border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" width="100%">
								<tr>
									<td colspan="7"><img src="templates/default/media/spacer.gif" width="21" height="6" alt=" "></td>
								</tr>
								
								<?php
									echo "<tr>\n";
									echo "<td width=\"1%\"><img src=\"templates/default/media/spacer.gif\" width=\"4\" height=\"1\" alt=\" \"></td>";
									echo "<td colspan=\"6\" class=\"G10B\" align=\"left\">\n";
									foreach ($master_array[("$tomorrows_date")] as $event_times) {
										foreach ($event_times as $my_key => $val) {
												$event_start 	= @$val["event_start"];
												$event_end 		= @$val["event_end"];
												$event_start 	= date ($hashmap["timeFormat"], @strtotime2 ("$event_start"));
												$event_end 		= date ($hashmap["timeFormat"], @strtotime2 ("$event_end"));
												$event_text_short = word_wrap($all_cals[$my_key]["summary"], 21, $tomorrows_events_lines);
												
                                                if (isset($val["start_unixtime"])) {
                                                  $start_date_full = localizeDate($hashmap["dateFormat_week_list"]." %Y", $val["start_unixtime"]);
                                                  $end_date_full = localizeDate($hashmap["dateFormat_week_list"]." %Y", $val["end_unixtime"]);

                                                  $event_start_full   = $start_date_full." ".date($hashmap["timeFormat"], $val["start_unixtime"]);
                                                  $event_end_full     = date($hashmap["timeFormat"], $val["end_unixtime"]);
                                                  if ($start_date_full != $end_date_full) { $event_end_full = $end_date_full." ".$event_end_full; }
                                                } else {
                                                  $event_start_full = localizeDate($hashmap["dateFormat_week_list"]." %Y", $unix_time);
                                                  $event_end_full = "";
                                                }

												$dadd = ",'".$all_cals[$my_key]["dorganizer"]."','".$all_cals[$my_key]["dattendee"]."','".$all_cals[$my_key]["dattendee_non"]."','".$all_cals[$my_key]["doptional"]."','".$all_cals[$my_key]["daccepted"]."','".$all_cals[$my_key]["ddeclined"]."','".$all_cals[$my_key]["dtentative"]."'";
												$dadd .= (isset($allday["recur"])?build_rep_showmenu($allday["recur"],$my_key):"");

												if (!isset($val["event_start"])) {
													$event_start = $hashmap["all_day_lang"];
													$event_end = '';
													echo "<a class=\"psf\" href=\"javascript:openEventInfo('$my_key','".$all_cals[$my_key]["calendar"]."')\" onmouseover=\"showmenu(event,'".ucfirst($all_cals[$my_key]["calendar"])."','".addslashes(htmlentities($all_cals[$my_key]["summary"]))."','".addslashes(htmlentities($all_cals[$my_key]["description"]))."','".addslashes(htmlentities($all_cals[$my_key]["location"]))."','".$all_cals[$my_key]["class"]."','".$all_cals[$my_key]["categories"]."','".$event_start_full."','".$event_end_full."'".$dadd."); return false;\" onmouseout=\"delayhidemenu()\"><i>".$event_text_short."</i></a><br>\n";
												} else {	
													echo "<a class=\"psf\" href=\"javascript:openEventInfo('$my_key','".$all_cals[$my_key]["calendar"]."')\" onmouseover=\"showmenu(event,'".ucfirst($all_cals[$my_key]["calendar"])."','".addslashes(htmlentities($all_cals[$my_key]["summary"]))."','".addslashes(htmlentities($all_cals[$my_key]["description"]))."','".addslashes(htmlentities($all_cals[$my_key]["location"]))."','".$all_cals[$my_key]["class"]."','".$all_cals[$my_key]["categories"]."','".$event_start_full."','".$event_end_full."'".$dadd."); return false;\" onmouseout=\"delayhidemenu()\"><font class=\"G10B\">&#149; ".$event_text_short."</font></a><br>\n";
												}
												
										}
									}
									echo "</td>\n";
									echo "</tr>\n";
								?>
							</table>
						</td>
					</tr>
					<tr>
						<td colspan="3" bgcolor="#FFFFFF"><img src="templates/default/media/spacer.gif" width="148" height="6" alt=" "></td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
	<br>
<?php 
	}
?>


	<table cellpadding="0" cellspacing="0" border="0" width="170">
		<tr>
			<td valign="middle" align="center">
				<table width="170" border="0" cellpadding="0" cellspacing="0" class="calborder">
					<tr>
						<td align="left" valign="top" width="1%" class="sideback"><img src="templates/default/media/spacer.gif" width="1" height="20" alt=" "></td>
						<td align="center" width="98%" class="sideback"><font class="G10BOLD"><?php echo $hashmap["legend"]; ?></font></td>
						<td align="right" valign="top" width="1%" class="sideback"></td>
					</tr>
					<tr>
						<td colspan="3" bgcolor="#FFFFFF" align="center">
							<table border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" width="100%">
								<tr>
									<td><img src="templates/default/media/spacer.gif" width="21" height="9" alt=" "></td>
									<td></td>
									<td><img src="templates/default/media/spacer.gif" width="21" height="9" alt=" "></td>
									<td></td>
								</tr>
								<?php
  								  foreach ($cal_legend as $item) {
								    echo '
									<tr>
									  <td></td>
									  <td valign="middle">
									  	<table border="0" cellpadding="0" cellspacing="0" width="21" height="10"><tr><td style="height: 10; width: 21; background-color: '.$item[1].'"><img src="templates/default/media/spacer.gif" width="21" height="10" alt="" border="1"></td></tr></table>
									  </td>
									  <td></td>
									  <td class="G10B">'.htmlspecialchars(ucfirst($item[0])).'</td>
									</tr>
									<tr>
									  <td><img src="templates/default/media/spacer.gif" width="21" height="5" alt=" "></td>
									</tr>
									';
								  }
								?>
							</table>
						</td>
					</tr>
					<tr>
						<td colspan="3" bgcolor="#FFFFFF"><img src="templates/default/media/spacer.gif" width="148" height="6" alt=" "></td>
					</tr>
				</table>
			</td>
		</tr>
	</table>

<!--
	<table cellpadding="0" cellspacing="0" border="0" width="170">
		<tr>
			<td valign="middle" align="center">
				<table width="170" border="0" cellpadding="0" cellspacing="0" class="calborder">
					<tr>
						<td colspan="3" bgcolor="#FFFFFF" align="left">
							<table border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" width="100%">
								<tr>
									<td colspan="2"><img src="templates/default/media/spacer.gif" width="21" height="3" alt=" "></td>
								</tr>
								<form action="search.php" method="GET">
								<tr>
									<td width="1%"><img src="templates/default/media/spacer.gif" width="4" height="1" alt=" "></td>
									<td valign="middle" align="left"><?php echo '<input type="Hidden" name="'.session_name().'" value="'.session_id().'"><input type="hidden" name="cal" value="'.$cal.'"><input type="hidden" name="getdate" value="'.$getdate.'"><input type="text" size="15" class="search_style" name="query" value="'.$hashmap["search_lang"].'" onfocus="javascript:if(this.value==\''.$hashmap["search_lang"].'\') {this.value=\'\';}" onblur="javascript:if(this.value==\'\') {this.value=\''.$hashmap["search_lang"].'\'}"><INPUT type="image" src="'.IMGPATH.'/search.gif" border=0 height="19" width="18" name="submit" align="absmiddle" value="Search">'; ?></td>
								</tr>
								</form>
								<tr>
									<td colspan="2"><img src="templates/default/media/spacer.gif" width="21" height="3" alt=" "></td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
-->
<?php
/*
 if ((isset($master_array['-2']))) { ?>
	<table cellpadding="0" cellspacing="0" border="0" width="170">
		<tr>
			<td valign="middle" align="center">
				<table width="170" border="0" cellpadding="0" cellspacing="0" class="calborder">
					<tr>
						<td align="left" valign="top" width="1%" class="sideback"><img src="templates/default/media/spacer.gif" width="1" height="20" alt=" "></td>
						<td align="center" width="98%" class="sideback"><font class="G10BOLD"><?php echo $hashmap["todo_lang"]; ?></font></td>
						<td align="right" valign="top" width="1%" class="sideback"></td>
					</tr>
					<tr>
						<td colspan="3" bgcolor="#FFFFFF" align="center">
							<table border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" width="100%">
								<tr>
									<td colspan="7"><img src="templates/default/media/spacer.gif" width="21" height="6" alt=" "></td>
								</tr>
								
								<?php
									echo "<tr>\n";
									echo "<td width=\"1%\"><img src=\"templates/default/media/spacer.gif\" width=\"4\" height=\"1\" alt=\" \"></td>";
									echo "<td colspan=\"6\" class=\"G10B\" align=\"left\">\n";
									echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n";
									foreach ($master_array['-2'] as $vtodo_times) {
										foreach ($vtodo_times as $val) {
											$vtodo_text = stripslashes(urldecode($val["vtodo_text"]));
											if ($vtodo_text != "") {	
												$description 	= $val["description"];
												$completed_date = $val['completed_date'];
												$status 		= $val["status"];
												$priority 		= $val['priority'];
												$start_date 	= $val["start_date"];
												$due_date 		= $val['due_date'];
												$vtodo_array 	= array(
													'cal'			=> $calendar_name,
													'completed_date'=> $completed_date,
													'description'	=> $description,
													'due_date'		=> $due_date,
													'priority'		=> $priority,
													'start_date'	=> $start_date,
													'status'		=> $status,
													'vtodo_text' 	=> $vtodo_text);

												$vtodo_array 	= base64_encode(serialize($vtodo_array));
												
												$vtodo_text 	= word_wrap(strip_tags(str_replace('<br>',' ',$vtodo_text), '<b><i><u>'), 21, $tomorrows_events_lines);
														$vtodo_link = "<a class=\"psf\" href=\"javascript:openTodoInfo('$vtodo_array')\">";
												
												if ($status == 'COMPLETED' || (isset($val['completed_date']) && isset($val['completed_time']))) {
														$vtodo_text = "<S>$vtodo_text</S>";
														echo "<tr><td>$vtodo_link<img src=\"templates/default/media/completed.gif\" alt=\" \" width=\"13\" height=\"11\" border=\"0\" align=\"middle\"></a></td>\n";
														echo "<td><img src=\"templates/default/media/spacer.gif\" width=\"2\" height=\"1\" border\"0\" /></td><td>$vtodo_link<font class=\"G10B\"> $vtodo_text</font></a></td></tr>\n";
												} elseif (isset($val['priority']) && ($val['priority'] != 0) && ($val['priority'] <= 5)) {
													echo "<tr><td>$vtodo_link<img src=\"templates/default/media/important.gif\" alt=\" \" width=\"13\" height=\"11\" border=\"0\" align=\"middle\"></a></td>\n";
													echo "<td><img src=\"templates/default/media/spacer.gif\" width=\"2\" height=\"1\" border\"0\" /></td><td>$vtodo_link<font class=\"G10B\"> $vtodo_text</font></a></td></tr>\n";
												} else {
													echo "<tr><td>$vtodo_link<img src=\"templates/default/media/not_completed.gif\" alt=\" \" width=\"13\" height=\"11\" border=\"0\" align=\"middle\"></a></td>\n";
													echo "<td><img src=\"templates/default/media/spacer.gif\" width=\"2\" height=\"1\" border\"0\" /></td><td>$vtodo_link<font class=\"G10B\"> $vtodo_text</font></a></td></tr>\n";
												}
											}
										}
									}
									echo "</table>\n";
									echo "</td>\n";
									echo "</tr>\n";
								?>
							</table>
						</td>
					</tr>
					<tr>
						<td colspan="3" bgcolor="#FFFFFF"><img src="templates/default/media/spacer.gif" width="148" height="6" alt=" "></td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
    <br>
<?php } */
?>	
