#!/usr/bin/perl -w


use strict;
use CGI qw(:standard);

my $query = new CGI;
my $option;


#
# Get the 'stylesheet' parameter returned from the form
my $stylesheet = $query->param('stylesheet');

unless ( $stylesheet )  {
   $stylesheet = $query->cookie(-name=>'stylesheet', -domain=>'.stidman.com');
}


#
# Prepare the cookie
my $stylesheet_cookie=$query->cookie( -name=>'stylesheet', -value=>$stylesheet, -expires=>'+12M', -domain=>'.stidman.com');


#
# Return the header and set the cookie
print $query->header(-cookie=>$stylesheet_cookie);




#print $query->header();
print start_html(-title=>'Stylesheet Selection', -style=>{-src=>'/cgi-bin/stylesheet.cgi'} );

printf <<EOF;
<DIV CLASS="outermost_container">
<DIV CLASS="title">Stylesheet Selection</DIV>

<DIV CLASS="content_outer">
<DIV CLASS="links">
<BR>
<BR>
<U><B>Select Stylesheet</B></U>
<FORM NAME="stylesheetform" ID="stylesheetform" ACTION="/cgi-bin/stylesheet-set.cgi" METHOD=POST>
   <SELECT NAME="stylesheet" SIZE="1" ONCHANGE="document.stylesheetform.submit();">
EOF

foreach $option ( 'DEFAULT', 'Simple', 'Ocean', 'Waves', 'Winter', 'Style2' ) {
   print('<OPTION ');
   if ( $stylesheet eq $option ) {
      print('SELECTED ');
   }
   print('VALUE="', $option, '">', $option, "</OPTION>\n");
}


printf <<EOF;
   </SELECT>
   <BR>
   <BR>
</FORM>
EOF


# print("<HR><B>Current Stylesheet: </B>", $stylesheet, "<BR><BR>\n");



printf <<EOF;
</DIV>
</DIV>
EOF



open (FOOTER_FILE, "< ../includes/directory-footer.shtml");

while (<FOOTER_FILE>) {
   printf($_);
}


