#!/usr/bin/perl

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

&chugCGI(*input);

$page = $input{"page"};



if($page eq ""){
    $page = 0;
}

if(length($page) == 1) { $page = "0".$page; }


$prevpage = $page - 1;
$nextpage = $page + 1;


if($page == 0){
    $blurb = <<__EOQ__;
<div align="center">

<br><br>Yee &amp; Lan: A Romance. Written by
<a href="http://kisrael.com"><font color="white">Kirk Israel</font></a>, 
illustrated by 
<a href="http://signalburst.org/mariska/"><font color="white">Marissa Saradpon</font></a>

<br><br><br><br>
<i>back to the <a href="/"><font color="white">blender of love</font></a></i>


</div>
__EOQ__


}


if($prevpage >= 0){
    $prevpagelink = <<__EOQ__;
    <a href="?page=$prevpage">previous</a>
__EOQ__
} else {
    $prevpagelink = "";
}


if($nextpage <= 15){
    $nextpagelink = <<__EOQ__;
    <a href="?page=$nextpage">next</a>
__EOQ__
$nexturl="?page=$nextpage";
} else {
    if($nextpage == 16){
    $nextpagelink = <<__EOQ__;
    <a href="?page=0">back to start</a>
__EOQ__
	$nexturl = "?page=0";

    } else {
    $nextpagelink = "";
}
}




$img = "yl".$page."_small.jpg";


print<<__EOQ__;

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
    <title>Yee &amp; Lan</title>
    <STYLE type="text/css">
     <!--
  A:link {font-family:Tahoma; color: #dddddd; font-size: x-small; text-decoration: none;  font-weight: bold;}
	    A:visited {font-family:Tahoma; color: #cccccc; font-size: x-small; text-decoration: none;  font-weight: bold;}
			 A:active {font-family:Tahoma; color: #dddddd; font-size: x-small; text-decoration: none;  font-weight: bold;}
				       HR {color: #333344}


       body,table,tr,td { font-family: Tahoma, Arial,
       Helvetica, sans-serif; font-size: x-small;  color: #ffffff;}



					        -->
						 </STYLE>
</head>

<body bgcolor="#000000">
<table border=0 align="center" cellspacing=0 cellpadding=0 width=500>
  <tr>
    <td colspan="3">

<a href="$nexturl"><img border=0 src="$img" width=500 height=500></a>
      </td>
  </tr>
  <tr>
    <td align="left">
$prevpagelink
      </td>
      <td>
      </td>
      <td align="right">





$nextpagelink

	</td>
	
  </tr>
</table>

$blurb
</body>
</html>



__EOQ__




sub chugCGI { local (*in) = @_ if @_; local ($i, $key, $val);
  if($ENV{'REQUEST_METHOD'}eq"POST") { read(STDIN,$in,$ENV{'CONTENT_LENGTH'});
     }else {$in = $ENV{'QUERY_STRING'};} @in = split(/&/,$in);
	      foreach $i (0 .. $#in) { $in[$i] =~ s/\+/ /g;
($key, $val) = split(/=/,$in[$i],2);$key =~ s/%(..)/pack("c",hex($1))/ge;
$val =~ s/%(..)/pack("c",hex($1))/ge; $in{$key}.= $val;}return length($in);}
