#!/usr/bin/perl
#######################
# A simple cgi program that displaus three buttons. One of the buttons can be 
# clicked on and it will turn blue, but when another is selected its color will
# change back. 
#
# v0.1 today - ajkl;ajklf;akddjjfff
# v0.2 tomorrow - added this, thajk
#
# Your Name Here
# sta
#######################
use warnings;
use strict;
use CGI qw(:standard);
$ENV{PATH} = '/usr/bin';

print "Content-type: text/html\n\n";

if ( param("a.x") ) {
  print htmlWebPage('check.jpg', 'button.jpg', 'button.jpg');
}
elsif ( param("b.x") ){
  print htmlWebPage('button.jpg', 'check.jpg', 'button.jpg');
}
elsif ( param("c.x") ) {
  print htmlWebPage('button.jpg', 'button.jpg', 'check.jpg');
}
else {
  print htmlWebPage('button.jpg', 'button.jpg', 'button.jpg');
}

# Return the HTML for the web page.
# Input: URL for each of 3 buttons to display.	
# Usage: print htmlWebPage('button1.gif', 'button2.gif', 'button3.gif');
sub htmlWebPage {
  my ($img1, $img2, $img3) = @_;
  return qq{
 <html>
 <head>
  <title>Buttons</title>
 </head>
 <body>
 }
 .
 qq{ This program is being run by "} . `/usr/bin/whoami` . qq{"<br>\n}
 .
 qq{
  <form>
  <input type="image" src="buttons/$img1" alt="Button1" name="a">
  <input type="image" src="buttons/$img2" alt="Button2" name="b">
  <input type="image" src="buttons/$img3" alt="Button3" name="c">
  </form>
 </body>
 </html>
  };
}
