<?
// clock.php3
 
// Example written by "C.A. Lademann" <cal@zls.com> 
//
// Converted from php2 to php3
// by Jeff Schmitt
//    March, 1998
//
//
//  Call with argument: ?arg=gif

//SetLogging(0);
//SetShowInfo(0) ;

function Hand($ang, $len, $style, $col) {
   global $im, $radius, $basesize, $PI;

   $point[0] = (sin($ang) * $len) + $radius;
   $point[1] = (cos($ang) * -1 * $len) + $radius;

   if ($style == 1) {
      $base = $radius / 15;
      $angbase = $ang + ($PI / 2);

      $point[2] = (sin($angbase) * $basesize) + $radius;
      $point[3] = (cos($angbase) * -1 * $basesize) + $radius;
      $point[4] = (sin($angbase) * -1 * $basesize) + $radius;
      $point[5] = (cos($angbase) * $basesize) + $radius;

      ImageFilledPolygon($im, $point, 3, $col);
   } else {
      ImageLine($im, $radius, $radius, $point[0], $point[1], $col);
   }
}


if ($arg == "gif") {
   // the Header() function prints information to the
   // HTTP transaction header returned by the web server
   Header("Content-type: image/gif");
   Header("Expires: ");

   $PI = 3.14159265358979323846;

   if (intval($argv[1]) > 0) {
      $size = intval($argv[1]);
   } else {
      $size = 256;
   }

   $radius = $size / 2;
   $basesize = $radius / 15;

   /* Create Image */
   $im = ImageCreate($size, $size);
   $transp = ImageColorAllocate($im, 254, 254, 254);
   $white = ImageColorAllocate($im, 255, 255, 255);
   $black = ImageColorAllocate($im, 0, 0, 0);
   $green = ImageColorAllocate($im, 0, 255, 0);
   $red = ImageColorAllocate($im, 255, 0, 0);
   $blue = ImageColorAllocate($im, 0, 0, 255);
   ImageColorTransparent($im, $transp);

   /* Draw Clock */
   ImageArc($im, $radius, $radius, $size, $size, 0, 360, $black);
   ImageFill($im, $radius, $radius, $white);

   $min = 0;
   while ($min < 60) {
      $min = $min + 5;

      if ($min % 15 == 0) {
         $len = doubleval($radius / 5);
      } else {
         $len = doubleval($radius / 10);
      }

      $ang = ($PI * $min * 2) / 60;
      $sin = sin($ang);
      $cos = cos($ang);
      $sx = $sin * ($radius - $len) + $radius;
      $sy = $cos * ($radius - $len) + $radius;
      $ex = $sin * $radius + $radius;
      $ey = $cos * $radius + $radius;

      ImageLine($im, $sx, $sy, $ex, $ey, $black);
   }

   $hour = intval(date("h", time()));
   if ($hour >= 12) {
      $hour -= 12;
   }

   $min = intval(date("i", time()));
   $sec = intval(date("s", time()));

   $ang = ($PI * 2 / 12) * (1.0 * $min / 60 + $hour);
   $len = 0.5 * $radius;
   Hand($ang, $len, 1, $blue);

   $ang = ($PI * 2 / 60) * (1.0 * $sec / 60 + $min);
   $len = 0.65 * $radius;
   Hand($ang, $len, 1, $green);

   $ang = ($PI * 2 / 60) * $sec;
   $len = 0.75 * $radius;
   Hand($ang, $len, 0, $black);

   ImageArc($im, $radius, $radius, 2 * $basesize, 2 * $basesize, 0, 360,
$red);
   ImageFillToBorder($im, $radius, $radius, $red, $red);

   ImageGif($im);
} else {
   $sizestr_gif = "";
   $sizestr_html = "";

   if (intval($argv[0]) > 0) {
      $sizestr_gif = sprintf("+%d", intval($argv[0]));
      $sizestr_html = sprintf("?%d", intval($argv[0]));
   }
?>
<HTML>
<HEAD>
   <META HTTP-EQUIV="Refresh" CONTENT=5 URL=<?echo $PHP_SELF,$sizestr_html;?>>
</HEAD>
<BODY>
<CENTER>
<IMG SRC=<?echo $PHP_SELF;?>?arg=gif<?echo $sizestr_gif;?>>
</CENTER>
</BODY>
</HTML>
<?
}
?>
body {
	background-color: #FFFFCC;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12px;
	line-height: 24px;
	color: #336699;
}

td, th {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 10px;
	line-height: normal;
	color: #FFF;
}

a {
	font-size: 12px;
	color: #336600;
}

form {
	background-color: #CCCC99;
}

.title {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12px;
	line-height: 20px;
	background-color: #99CC00;
	color: #003333;
}

.subtitle {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 16px;
	line-height: 30px;
 color: #003300;}

.header {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 20px;
	background-color: #669900;
 color: #FFFF33;
}

.nav {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 14px;
	font-weight: normal;
	background-color: #CCFF99;
}

.navLink {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 14px;
	font-weight: bold;
	background-color: #DEDECA;
}

.sidebar {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 10px;
	line-height: 14px;
	padding: 3px;
	background-color: #FFFFCC;
 color: #003333;
}

.sidebarHeader {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 14px;
	line-height: 18px;
	color: #003300;
	background-color: #FFFF66;
}

.sidebarFooter {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12px;
	line-height: 18px;
	background-color: #FFFF99;
 font-style: italic;
}

.footer {
  font-family: Arial, Helvetica, sans-serif;
	font-size: 14px;
	font-weight: bold;
	line-height: 22px;
	color: #333333;
	background-color: #CCFF99;
}

.legal {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 9px;
	color: #333333;
}

.box1 {
	border-width: thin;
	border-color: #99FF99 #003300 #003300 #99FF99;
 border-style: double;
 }

.promo {
	font-family: "Times New Roman", Times, serif;
	color: #000033;
}

.titlebar {
	font-family: "Times New Roman", Times, serif;
	font-size: 9px;
	color: #FFFFFF;
	background-color: #336699;
}

.dingbat {
	font-family: Arial, Helvetica, sans-serif;
	background-color: #FFFFFF;
 color: #660000; font-weight: bolder; font-size: medium;
 }

input.big {
	width: 100px;
}

input.small {
	width: 50px;
}
