Index: trunk/tools/czarcal
===================================================================
--- trunk/tools/czarcal	(revision 34894)
+++ trunk/tools/czarcal	(revision 36178)
@@ -16,18 +16,37 @@
 my $start_date = shift;
 my $num_assignments = shift;
-
 $num_assignments = 1 unless $num_assignments;
 
+my $num_events = 0;
 
 # list of all czars
 my @staff = qw(
+bill
+chris
 mark
 gene
-bill
 heather
-chris
 );
 
-die "usage: $0 <first czar> <start_date> <num assignments>\n  czar list: @staff\n"
+my @date_holidays = qw(
+0101
+0326
+0611
+0816
+1225
+);
+# MMNW
+my @weekday_holidays = qw(
+0131
+0231
+0541
+0911
+1121
+1144
+);
+
+
+
+die "usage: $0 <first czar> <start_date> [<num assignments>]\n  czar list: @staff\n"
     unless $start_date and $first_czar;
 
@@ -48,5 +67,4 @@
 
 
-
 my $year = substr $start_date, 0, 4;
 my $month = substr $start_date, 4, 2;
@@ -62,5 +80,11 @@
 for (my $i = 0; $i < $num_assignments; $i++) {
     $tm = localtime($time);
-    if ($tm->wday != 6 and $tm->wday != 0) {
+    if ($tm->wday == 6 or $tm->wday == 0) {
+        # bump counter to account for weekend day
+        $num_assignments++;
+    } elsif (is_holiday($tm)) {
+        # bump counter to account for holiday
+        $num_assignments++;
+    } else {
 
         assign_czar($this_czar, $tm->year+1900, $tm->mon+1, $tm->mday);
@@ -73,13 +97,11 @@
             $j = 0;
         }
-    } else {
-        # bump counter to account for weekend day
-        $num_assignments++;
     }
     $time += 86400;
 }
 
+print "$end_vcalendar\n";
 
-print "$end_vcalendar\n";
+exit 0;
 
 sub get_czars {
@@ -97,5 +119,4 @@
 }
 
-my $num_events = 0;
 sub assign_czar {
 #    print STDERR "assign: @_\n";
@@ -132,3 +153,26 @@
 }
 
+sub is_holiday {
+    my $tm = shift;
 
+    my $slimdate = sprintf "%02d%02d", $tm->mon + 1, $tm->mday;
+    foreach my $d (@date_holidays) {
+        if ($d eq $slimdate) {
+            print STDERR "$d is a date holiday\n";
+            return 1;
+        }
+    }
+
+    my $monthDayOfWeek = sprintf "%02d%d%d", $tm->mon + 1, 1 + ($tm->mday - $tm->wday) / 7, $tm->wday;
+
+    foreach my $d (@weekday_holidays) {
+        if ($d eq $monthDayOfWeek) {
+            print STDERR "$slimdate is a $d day of week holiday\n";
+            return 1;
+        }
+    }
+
+    return 0;
+}
+
+
