<?php
function gcalendar(){
   $today = date(d);
   $days = date(t);
   $monat = date(m);
   $year = date(y);
   $firstday = mktime(0,0,1,$month,1,$year);
   $lastday = mktime(0,0,1,$month,$days,$year);
   $first = date(w,$firstday);
   $last = date(w,$lastday);
   $diff = 7-$last;
   $jahr = date(Y);

   $months = array($asl['jan'], $asl['feb'], $asl['mar'], $asl['apr'], $asl['maj'], $asl['jun'],
                   $asl['jul'], $asl['aug'], $asl['sep'], $asl['oct'], $asl['nov'], $asl['dec']);
   $monat  = $months[date("n", time())-1];

   if($first == 0) $first = 7;
   if($last == 0) $last = 7;

   for($i=1;$i<$first;$i++) {
      $begin.= "<td></td>";
   }

   for($i=0;$i<$diff;$i++) {
      $end.= "<td></td>";
   }

   echo "<table border= '0' cellspacing= '2' cellpadding= '0 ' width='100%'>";
     echo   "<tr bgcolor= '#990000'>";
     echo   "<th>";
   echo $asl['mo'];
   echo "</th><th>";
   echo $asl['tu'];
   echo "</th><th>";
   echo $asl['we'];
   echo "</th><th>";
   echo $asl['th'];
   echo "</th><th>";
   echo $asl['fr'];
   echo "</th><th>";
   echo $asl['sa'];
   echo "</th><th>";
   echo $asl['su'];
   echo "</th>
        </tr><tr>
        $begin";

   for($i=1;$i<($days+1);$i++) {
      if($first==0):
         echo "<tr>";endif;

      if($i == $today) {
         echo "<td bgcolor='#990000' align='center'>$i</td>";
      }
      else {
         echo "<td align= 'center'>$i</td>";
      }

      if($first==7):
         echo "</tr>";
         $first=0;
      endif;

      $first++;     

   }

   echo $end."</tr>";
   echo "<tr><td colspan='7' align='center'><b>$monat $jahr</b></td></tr>";
   echo "</table>";
}
?>