#!/usr/bin/perl

use URI::Escape;

print <<EOT;
<?xml version="1.0"?>
<html>
 <head>
  <title>Graph</title>
 </head>
 <body bgcolor="white" onLoad="window.focus()">
  <script>
<![CDATA[
   // NOTE: getParam will be defined during the application
   // of the next stylesheet in the stylesheet chain
   var draw_graphURL = unescape(getParam("param.draw_graphURL"));
   document.write('<img border="false" src="' + draw_graphURL + 'get_gif?pid=$ARGV[0]" usemap="#graphe">');
]]>
  </script>
  <map name="graphe">
EOT

my $count = 0;

while (<STDIN>) {
 $count++;
 my (undef,$point1,$point2,$uri) = split;
 my ($point1x,$point1y) = split /,/,$point1;
 my ($point2x,$point2y) = split /,/,$point2;
 $point1y = substr($point1y,0,-1);
 $point2y = substr($point2y,0,-1);
 $point1x = substr($point1x,1);
 $point2x = substr($point2x,1);

 print <<EOT;
   <area shape="rect" href="$uri" coords="$point1x,$point2y,$point2x,$point1y" />
EOT
}

print <<EOT;
   </map>
  <script>
<![CDATA[
   document.write('</img>');
]]>
  </script>
 </body>
</html>
EOT
