#!/usr/bin/perl

## for the other - !/usr/bin/perl
                 use lib "d:/perl5/"; ## for the other: ##

## Perl script to display all lots 
## ===============================
## INPUT
## - None
## PROCESS
## - read in current data file
## - search for each lot reference in it 
## - collect the corresponding value 
##   - send them in as a parameter to the function called by MouseOver
## - check each lot if they are reserved 
##   and use this information to determine what the user sees:
##   - si for sale                => green
##   - si aux progress de drawing => yellow 
##   - si finished                => red
##   (status = existence of certain files: 
##     none, lotNN.cho, lotNN.nve respectively) 
## OUTPUT
## - generated HTML and javascript code with lock and gif references 

## Setup some global variables.

$version        = "3.0 Alpha - Csaba Csaki";
$last_update    = "Aug 30 - Oct 1, 1999";
$title          = "Greylands Homes Lots Map";

$query_string   = $ENV{QUERY_STRING};

## These are common CGI library routines by Steven E. Brenner.
require ('cgi-lib.pl') || die "can\'t require cgi-lib.pl: $!";

## This routine is supplied by the CGI library, it turns the data 
## and value inputs into an associative array called 'in'.
&ReadParse;

## If there is a query string then use it to get query string values, 
## otherwise get the action from an input in a form.
if ($query_string ne "") {  
    ($language) = split (/\+/, $query_string);
} else {
    $language =  $in{language}; ## "coords" ; 
}

## Setup some global variables.
require ('setup.pl') || die "can\'t require setup.pl: $!";

## load text pieces 
$line_index = 1; 
if (open (FILE, "<../$lot_dir/textall$language$data_extension")) {
  while(<FILE>) {
    chop; 
    $text[$line_index] = $_ ; 
    $line_index++; 
  }
  close(FILE) ;  
} else {
  for ($line_index .. 100) { 
      $text[$line_index] = "error" ;     
  }
} 

## how many triangles and polygons... 
$last_rectangle = 55 ;

## definition of zone codes
@zoning_type[5] ;
$zoning_type[1] = $text[7] ;
$zoning_type[2] = $text[8] ;
$zoning_type[3] = $text[9] ;
$zoning_type[4] = $text[10]  ;

## definition of the lot coordinates for the mouse-in/out detection 
@coords[$last_lotnumber+1];

if (!open (FILE, "<$lot_dir/coords.dat")) {
  for $lot_index (1 .. $last_lotnumber ) {
    $first  = $lot_index*3 ; 
    $second = $lot_index*3+3 ; 
    $coords[$lot_index] = "$first,$first,$first,$second,$second,$second,$second,$first"; 
  }
} else {
  $lots_data = join ("", <FILE>);
  for $lot_index (1 .. $last_lotnumber ) { 
    $lots_data =~ /(.*)\|lot$lot_index\|\n(.*?)\n(.*)/s;
    chomp($2); 
    $coords[$lot_index] = $2 ;  
  }
  close(FILE) ;  
}

## here starts the actual html code generation 
##(referencing the Perl definitions above) 
print "
<HTML>
<HEAD>
    <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">
    <META NAME=\"GENERATOR\" CONTENT=\"Mozilla/4.01 [en] (Win95; I) [Netscape]\">
    <TITLE>$title on $host_name</TITLE>
  <STYLE TYPE=\"text/css\"> \
   #Layer1 { position:absolute; width:104px; height:99px; z-index:14; left: 125px; top: 85px; }
   #LotText { position: absolute; visibility: hidden; top: 250; left: 145; z-index: 15; }
   #ZoningText { position: absolute; visibility: hidden; top: 307; left: 145; z-index: 16;}
   #AreaText { position: absolute; visibility: hidden; top: 363; left: 145; z-index: 17;}
   #ResidueText { position: absolute; visibility: hidden; top: 417; left: 145; z-index: 18;}
   #HistoryText { position: absolute; visibility: hidden; top: 485; left: 140; width: 360px; z-index: 19;}
   #SiteMap { position: relative; left: 300px; top: 0px;}   <!-- Main DIV container -->
   #SiteMapUp { position: absolute; top: 0; left: 0; }  <!-- Contains reg. image -->
   #SiteMapOver { position: absolute; visibility: hidden; top: 0; left: 0; }  <!-- Contains Purchased MouseOver image -->
   #SiteMapRed { position: absolute; visibility: hidden; top: 0; left: 0; }  <!-- Contains Booked/Reserved MouseOver image -->
   #SiteMapGreen { position: absolute; visibility: hidden; top: 0; left: 0; }  <!-- Contains Avialable MouseOver image -->
   #MenuBar { position: absolute; left: 720px; top: 82px; }  
</STYLE>

  <center>
";

##   <br>
##   <FONT COLOR=\"#ff8000\" SIZE=4>
##     WELCOME TO GREYLANDS HOMES BY BORDERLINE DEVELOPMENTS 
##   </FONT>

if ($language eq "f") {
  $title_length = 185 ; 
} else {
  $title_length = 113 ; 
}

print "
        <img src=\"$image_path/sitemap$language.gif\" width=\"$title_length\" height=\"33\">
        <img src=\"$image_path/maplog.gif\" width=\"32\" height=\"33\">
   <br><br><br>
  </center>

  <SCRIPT language=\"JavaScript\">  
   <!-- Hide from non-javaScript browsers...

   // Set up Lot-Info arrays...
"; 

## generating data for individual lots based on info read in from lots data file
print"
   efface   = new Array(\"$text[1]\", \"$text[2]\", \"$text[3]\", \"$text[4]\", \"$text[5]\", \"$text[6]\", \"1\");
";

if (!open (FILE, "</home/greylands/public_html/classes/robots/lots/alllots.dat")) {
#if (!open (FILE, "<$lot_dir/alllots$language$data_extension")) {
  print"aa = new Array(\"1\", \"commercial\", \"120\",  \"/////\",  \"Oops...\", \"\", \"\");
  ";
  for $lot_index (1 .. $lots_set_up) { 
    print"
      lot_data$lot_index = new Array(\"$lot_index\", \"\", \"\", \"\", \"\", \"\", \"\");
    ";
  }  
} else {
  $lots_data = join ("", <FILE>);
  for $lot_index (1 .. $lots_set_up) { 
    $plus_one = $lot_index+1;
    $lots_data =~ /(.*)\|lot$lot_index\|\n(.*?) (.*?) (.*?)\n(.*?)\n\n(.*?)(.*)/s;

    chomp($4);
##    chomp($5);

    $lot_data[$lot_index][0] = $lot_index ; 
    $lot_data[$lot_index][1] = $zoning_type[$2] ; 
    $lot_data[$lot_index][2] = $3 ; 

    print"
     lot_data$lot_index = new Array(\"$lot_index\", \"$zoning_type[$2]\", \"$3\", \"";

    for $index (1 .. $4) { 
      print "//" ; 
    }
    $lot_data[$lot_index][3] = "$4" ;

    $lot_data[$lot_index][4] = "$5" ; 
    $lot_data[$lot_index][4] =~ tr/\n/ /s ;
    print"\", \"$lot_data[$lot_index][4]\", \"\", \"$4\");
    ";
  };

  print"
     aa = new Array(\"1\", \"commercial\", \"120\",  \"/////\", \"Yo\", \"\", \"1\");
  ";
}

## Overlay data for clip rectangles...
print"
  // Set up Clip arrays for MouseOver... [Left, Top, Right, Bottom]
    L1 = new Array(\"39\", \"273\", \"68\", \"291\");
    L2 = new Array(\"71\", \"273\", \"94\", \"290\");
    L3 = new Array(\"40\", \"254\", \"70\", \"272\");
    L4 = new Array(\"70\", \"254\", \"92\", \"272\");
    L5 = new Array(\"40\", \"237\", \"68\", \"253\");
    L6 = new Array(\"71\", \"238\", \"93\", \"253\");
    L7 = new Array(\"40\", \"221\", \"68\", \"236\");
    L8 = new Array(\"70\", \"221\", \"92\", \"236\");
    L9 = new Array(\"39\", \"204\", \"68\", \"219\");
    L10 = new Array(\"70\", \"204\", \"92\", \"219\");
    L11 = new Array(\"40\", \"188\", \"68\", \"203\"); 
    L12 = new Array(\"70\", \"188\", \"92\", \"203\");
    L13 = new Array(\"39\", \"170\", \"66\", \"186\");
    L14 = new Array(\"70\", \"170\", \"92\", \"186\");
    L15 = new Array(\"40\", \"151\", \"67\", \"168\");
    L16 = new Array(\"70\", \"150\", \"93\", \"168\");
    L17 = new Array(\"39\", \"132\", \"66\", \"150\");
    L18 = new Array(\"69\", \"132\", \"92\", \"149\");
    L19 = new Array(\"38\", \"105\", \"56\", \"131\");
    L20 = new Array(\"58\", \"105\", \"74\", \"131\");
    L21 = new Array(\"78\", \"105\", \"93\", \"131\");
    L22 = new Array(\"112\", \"273\", \"138\", \"291\");
    L23 = new Array(\"140\", \"273\", \"166\", \"290\");
    L24 = new Array(\"112\", \"254\", \"138\", \"271\");
    L25 = new Array(\"140\", \"254\", \"166\", \"271\");
    L26 = new Array(\"111\", \"238\", \"137\", \"253\");
    L27 = new Array(\"140\", \"237\", \"166\", \"252\"); 
    L28 = new Array(\"111\", \"221\", \"136\", \"237\");
    L29 = new Array(\"140\", \"221\", \"165\", \"236\");
    L30 = new Array(\"111\", \"204\", \"137\", \"220\");
    L31 = new Array(\"139\", \"204\", \"166\", \"219\");
    L32 = new Array(\"111\", \"187\", \"137\", \"203\");
    L33 = new Array(\"139\", \"187\", \"165\", \"202\");
    L34 = new Array(\"111\", \"169\", \"137\", \"186\");
    L35 = new Array(\"139\", \"169\", \"165\", \"186\");
    L36 = new Array(\"110\", \"150\", \"136\", \"169\");
    L37 = new Array(\"139\", \"149\", \"166\", \"168\");
    L38 = new Array(\"111\", \"132\", \"136\", \"149\");
    L39 = new Array(\"138\", \"132\", \"165\", \"148\");
    L40 = new Array(\"110\", \"105\", \"125\", \"131\");
    L41 = new Array(\"127\", \"104\", \"147\", \"130\");
    L42 = new Array(\"148\", \"104\", \"166\", \"130\");
    L43 = new Array(\"191\", \"277\", \"217\", \"298\");
    L44 = new Array(\"218\", \"277\", \"242\", \"298\");
    L45 = new Array(\"191\", \"258\", \"215\", \"277\");
    L46 = new Array(\"218\", \"258\", \"242\", \"277\");
    L47 = new Array(\"191\", \"240\", \"214\", \"257\");
    L48 = new Array(\"218\", \"241\", \"241\", \"257\");
    L49 = new Array(\"191\", \"223\", \"216\", \"239\");
    L50 = new Array(\"217\", \"223\", \"241\", \"239\");
    L51 = new Array(\"190\", \"205\", \"216\", \"222\");
    L52 = new Array(\"217\", \"205\", \"241\", \"222\");
    L53 = new Array(\"190\", \"188\", \"215\", \"205\");
    L54 = new Array(\"217\", \"188\", \"240\", \"204\");
    L55 = new Array(\"190\", \"169\", \"216\", \"187\");
    L56 = new Array(\"217\", \"169\", \"235\", \"186\");
    L57 = new Array(\"189\", \"146\", \"215\", \"168\");
    L58 = new Array(\"257\", \"274\", \"278\", \"299\");
    L59 = new Array(\"279\", \"279\", \"299\", \"303\");
    L60 = new Array(\"254\", \"249\", \"275\", \"273\");
    L61 = new Array(\"319\", \"282\", \"337\", \"303\");
    L62 = new Array(\"300\", \"277\", \"317\", \"298\");
    L63 = new Array(\"285\", \"265\", \"312\", \"278\");
    L64 = new Array(\"276\", \"247\", \"296\", \"265\");
    L65 = new Array(\"261\", \"230\", \"281\", \"248\");
    L66 = new Array(\"253\", \"205\", \"271\", \"230\");
";

## Javascript functions
print"
//-----FUNCTIONS:

 function setup()  // Set variables to access document objects (different for NS and IE)
  { 
   if(document.layers)           // for NetScape
    { 
     objLayer1  = document.Layer1 ;
     objLotText = document.LotText ;
     objZoningText = document.ZoningText ; 
     objAreaText = document.AreaText ; 
     objResidueText = document.ResidueText ; 
     objHistoryText = document.HistoryText ; 
     objCarteForm = document.myForm.document.carte ;
     objSiteMap = document.SiteMap; 
     objSiteMapUp = document.SiteMap.document.SiteMapUp; 
     objSiteMapOver = document.SiteMap.document.SiteMapOver; 
     objSiteMapRed = document.SiteMap.document.SiteMapRed; 
     objSiteMapGreen = document.SiteMap.document.SiteMapGreen;
     objMenuBar = document.MenuBar;
    }
   else if(document.all)         // for IE
    {
     objLayer1  = document.all.Layer1.style ;
     objLotText = document.all.LotText.style ;
     objZoningText = document.all.ZoningText.style ; 
     objAreaText = document.all.AreaText.style ; 
     objResidueText = document.all.ResidueText.style ; 
     objHistoryText = document.all.HistoryText.style ; 
     objCarteForm = document.all.carte ;
     objSiteMap = document.all.SiteMap;  
     objSiteMapUp = document.all.SiteMapUp.style; 
     objSiteMapOver = document.all.SiteMapOver.style; 
     objSiteMapRed = document.all.SiteMapRed.style;
     objSiteMapGreen = document.all.SiteMapGreen.style; 
     objMenuBar = document.all.MenuBar.style;
     objLayer1.top = 110 ; 
     objMenuBar.top = 105 ; 
    }
  } 

 function mapOver(on, done, arLot)  // Toggle SiteMapOver and SiteMapRed visibility...
  {
   if (on) 
    { // Clip the area of the Over image to be displayed... after deciding which one
      // To facilate the coords i used Fireworks mapping - it gives coords (Left, Top, Right, Bottom)

     if (done) 
	{
        if(document.layers)  // for NetScape
         {
      	objSiteMapRed.clip.top = arLot[1];
        	objSiteMapRed.clip.left = arLot[0];
        	objSiteMapRed.clip.bottom = arLot[3];
        	objSiteMapRed.clip.right = arLot[2];
         }
        else if(document.all)         // for IE
         {
         	objSiteMapRed.clip = \"rect(\" + arLot[1] + \" \" + arLot[2] + \" \" + arLot[3] + \" \" + arLot[0] + \")\";
         }
        objSiteMapOver.visibility = \"hidden\";
        objSiteMapRed.visibility = \"visible\";
      }
	else 
      {
        if(document.layers)  // for NetScape
         {
       	objSiteMapOver.clip.top = arLot[1];
        	objSiteMapOver.clip.left = arLot[0];
        	objSiteMapOver.clip.bottom = arLot[3];
        	objSiteMapOver.clip.right = arLot[2];
         }
        else if(document.all)         // for IE
         {
         	objSiteMapOver.clip = \"rect(\" + arLot[1] + \" \" + arLot[2] + \" \" + arLot[3] + \" \" + arLot[0] + \")\";
         }
        objSiteMapOver.visibility = \"visible\";
        objSiteMapRed.visibility = \"hidden\";
      }
    }
   else 
    {
     if (done)
      {
        if(document.layers)  // for NetScape
         {
       	objSiteMapGreen.clip.top = arLot[1];
        	objSiteMapGreen.clip.left = arLot[0];
        	objSiteMapGreen.clip.bottom = arLot[3];
        	objSiteMapGreen.clip.right = arLot[2];
         }
        else if(document.all)         // for IE
         {
         	objSiteMapGreen.clip = \"rect(\" + arLot[1] + \" \" + arLot[2] + \" \" + arLot[3] + \" \" + arLot[0] + \")\";
         }
        objSiteMapGreen.visibility = \"visible\";
        objSiteMapOver.visibility = \"hidden\";
        objSiteMapRed.visibility = \"hidden\";
      }
     else
      { 
        objSiteMapOver.visibility = \"hidden\";
        objSiteMapRed.visibility = \"hidden\";
        objSiteMapGreen.visibility = \"hidden\";
      }
    }
  }

  function affiche(pays)    // Show Lot Info...
  { 
    if(document.layers) {                             // for NetScape 
      document.layerLotText.document.write(\"<FONT face='Arial, Helvetica, sans-seriff' SIZE=2>\") ;
      document.layerLotText.document.write(pays[0]) ;
      document.layerLotText.document.write(\"</FONT>\") ;
      document.layerLotText.document.close() ;
      document.layerZoningText.document.write(\"<FONT face='Arial, Helvetica, sans-seriff' SIZE=2>\") ;
      document.layerZoningText.document.write(pays[1]) ;
      document.layerZoningText.document.write(\"</FONT>\") ;
      document.layerZoningText.document.close() ;
      document.layerAreaText.document.write(\"<FONT face='Arial, Helvetica, sans-seriff' SIZE=2>\") ;
      document.layerAreaText.document.write(pays[2]) ;
      document.layerAreaText.document.write(\"</FONT>\") ;
      document.layerAreaText.document.close() ;
      document.layerResidueText.document.write(\"<FONT face='Arial, Helvetica, sans-seriff' SIZE=2>\") ;
      document.layerResidueText.document.write(pays[3]) ;
      document.layerResidueText.document.write(\"</FONT>\") ;
      document.layerResidueText.document.close() ;
      document.layerHistoryText.document.write(\"<FONT face='Arial, Helvetica, sans-seriff' SIZE=2>\") ;
      document.layerHistoryText.document.write(pays[4]) ;
      document.layerHistoryText.document.write(\"</FONT>\") ;
      document.layerHistoryText.document.close() ;
    } else if(document.all) {                         // for IE
      var range = document.body.createTextRange() ;
      for (i=0; i<5; i++) {
        if (range.findText(efface[i]) != -1) {
          range.scrollIntoView() ; 
          range.select() ; 
	  range.text = pays[i]; 
        } 
      }
      objLotText.visibility = \"visible\" ;
      objZoningText.visibility = \"visible\" ; 
      objAreaText.visibility = \"visible\" ; 
      objResidueText.visibility = \"visible\" ; 
      objHistoryText.visibility = \"visible\" ; 
    }
    with (objCarteForm)
    { lot.value      = pays[0];
      zoning.value   = pays[1];
      area.value     = pays[2];
      toxicity.value = pays[6];
      history.value  = pays[4];
      if ((pays[0] == \"$text[1]\") || (pays[0] == \"\")) {
        button.value = pays[5];
      } else {
        button.value = \"$text[11]\" + pays[0]; 
      }
    }

    // store values, so we can restore in case the user plays with them 
    for (i=0; i<7; i++) {
      efface[i] = pays[i]; 
    } 

// = 200; 
  }

  function setAction(form) // set the action to perform when the CGI button is hit
  { 
    if ( (objCarteForm.lot.value != \"\") && (objCarteForm.button.value != \"$text[6]\") ) {
        affiche(efface); // set the original values in case user fooled around...
	form.action = \"$host_URL/cgi-bin/onelot.pl\" ;
    }
  }

//--- Lot sale status - generated as late as possible.

";

## Lot sale status table generation 
## (as late in the code generation as possible for the most up-to-date data) 
for $lot_index (1 .. $lots_set_up) { 

  ## the basic assumption is that nothing has happened (green is "false,true")
  $lock_status    = "false" ; 
  $done_status    = "true" ; 
  $reserved_file  = "$lot_dir/lot$lot_index$lot_reserved_extension" ; 
  $lock_file      = "$lot_dir/lot$lot_index$lot_lock_extension" ; 
  $done_file      = "$lot_dir/lot$lot_index$lot_done_extension" ; 
  $reserved_check = $reserved_file or die "well..." ; 
  $lock_check     = $lock_file or die "well..." ; 
  $done_check     = $done_file or die "well..." ; 

  if ( (-e $lock_check) ||(-e $reserved_check) ) {
    $lock_status = "true" ; 
    if (!(-e $done_check)) {
      $done_status = "false" ;
    } 
  };

  print"    lot_status$lot_index = new Array($lock_status,$done_status);
  ";
  $lot_index++ ; 
};

## end of Javascript code 
print"
  // End script -->
 </SCRIPT>
</HEAD>";

## here starts the generation of html body
if ($language eq "f") {
  $lot_top          = "240px" ; 
  $lot_left         = "0px" ; 
  $lot_width        = 138 ; 
  $lot_height       = 38 ; 
  $zone_top         = "298px" ; 
  $zone_left        = "0px" ; 
  $zone_width       = 138 ; 
  $zone_height      = 38 ; 
  $area_top         = "355px" ; 
  $area_left        = "0px" ; 
  $area_width       = 138 ; 
  $area_height      = 38 ; 
  $residue_top      = "408px" ; 
  $residue_left     = "0px" ; 
  $residue_width    = 138 ; 
  $residue_height   = 38 ; 
  $histoire_top     = "472px" ; 
  $histoire_left    = "0px" ; 
  $histoire_largeur = 138 ; 
  $histoire_height  = 38 ; 
} else {
  $lot_top          = "243px" ; 
  $lot_left         = "85px" ; 
  $lot_width        =  39; 
  $lot_height       =  31; 
  $zone_top         = "297px" ; 
  $zone_left        = "54px" ; 
  $zone_width       = 74 ; 
  $zone_height      = 36 ; 
  $area_top         = "361px" ; 
  $area_left        = "70px" ; 
  $area_width       = 54 ; 
  $area_height      = 26 ; 
  $residue_top      = "408px" ; 
  $residue_left     = "48px" ; 
  $residue_width    = 78 ; 
  $residue_height   = 32 ; 
  $histoire_top     = "472px" ; 
  $histoire_left    = "53px" ; 
  $histoire_largeur = 71 ; 
  $histoire_height  = 35 ; 
}
print"

<BODY onLoad=\"setup(); affiche(efface)\" BGCOLOR=\"#CC6600\" TEXT=\"#333300\" 
     BACKGROUND=\"$image_path/ortile.jpg\">
<FONT SIZE=3>

<div id=\"Layer1\">
 <img src=\"$greyland_gif\" width=\"134\" height=\"119\"></div>
<div id=\"Layer4\" style=\"position: absolute; left: $lot_left; top: $lot_top; width: 40px; height: 30px; z-index: 4; background: #CC6600;\">
 <img src=\"$image_path/text_lot$language.gif\" width=\"$lot_width\" height=\"$lot_height\"></div>
<div id=\"Layer5\" style=\"position: absolute; left: 126px; top: 234px; width: 130px; height: 46px; z-index: 5; background: #CC6600; \"> 
  <img src=\"$image_path/dialog_dark.gif\" width=\"132\" height=\"47\"></div>
<div id=\"Layer6\" style=\"position: absolute; left: $zone_left; top: $zone_top; width: 34px; height: 26px; z-index: 6; background: #CC6600;\">
 <img src=\"$image_path/text_zoning$language.gif\" width=\"$zone_width\" height=\"$zone_height\"></div>
<div id=\"Layer7\" style=\"position: absolute; left: 126px; top: 292px; width: 130px; height: 46px; z-index: 7; background: #CC6600;\">
 <img src=\"$image_path/dialog_dark.gif\" width=\"132\" height=\"47\"></div>
<div id=\"Layer8\" style=\"position: absolute; left: $area_left; top: $area_top; width: 39px; height: 16px; z-index: 8; background: #CC6600;\">
 <img src=\"$image_path/text_area$language.gif\" width=\"$area_width\" height=\"$area_height\"></div>
<div id=\"Layer9\" style=\"position: absolute; left: 126px; top: 347px; width: 121px; height: 48px; z-index: 9; background: #CC6600;\">
 <img src=\"$image_path/dialog_dark.gif\" width=\"132\" height=\"49\"></div>
<div id=\"Layer10\" style=\"position: absolute; left: $residue_left; top: $residue_top; width: 55px; height: 20px; z-index: 10; background: #CC6600;\">
 <img src=\"$image_path/text_residue$language.gif\" width=\"$residue_width\" height=\"$residue_height\"></div>
<div id=\"Layer11\" style=\"position: absolute; left: 126px; top: 401px; width: 1px; height: 1px; z-index: 11; background: #CC6600;\">
 <img src=\"$image_path/dialog_dark.gif\" width=\"132\" height=\"47\"></div>
<div id=\"Layer12\" style=\"position: absolute; left: $histoire_left; top: $histoire_top; width: 59px; height: 28px; z-index: 12; background: #CC6600;\">
 <img src=\"$image_path/text_history$language.gif\" width=\"$histoire_largeur\" height=\"$histoire_height\"></div>
<div id=\"Layer13\" style=\"position: absolute; left: 128px; top: 472px; width: 421px; height: 92px; z-index: 13; background: #CC6600;\">
 <img src=\"$image_path/dialog_large.jpg\" width=\"420\" height=\"91\"></div>

 <DIV Id=\"LotText\"><FONT face=\"Arial, Helvetica, sans-seriff\" SIZE=2>$text[1]</FONT></DIV>
 <DIV Id=\"ZoningText\"><FONT face=\"Arial, Helvetica, sans-seriff\" SIZE=2>$text[2]</FONT></DIV>
 <DIV Id=\"AreaText\"><FONT face=\"Arial, Helvetica, sans-seriff\" SIZE=2>$text[3]</FONT></DIV>
 <DIV Id=\"ResidueText\"><FONT face=\"Arial, Helvetica, sans-seriff\" SIZE=2>$text[4]</FONT></DIV>
 <DIV Id=\"HistoryText\"><FONT face=\"Arial, Helvetica, sans-seriff\" SIZE=2>$text[5]</FONT></DIV>

 <DIV Id=\"SiteMap\">  <!-- The 4 images occupy the same physical space as specified in the CSS -->

 <DIV Id=\"SiteMapUp\">
  <IMG Src=\"$image_path/sitelot.gif\" Width=\"378\" Height=\"378\" UseMap=\"#mapSite\" 
       Border=\"0\" NaturalSizeFlag=\"0\" ALIGN=\"Bottom\" IsMap> 
 </DIV>

 <DIV Id=\"SiteMapOver\">
  <IMG Src=\"$image_path/sitelot1.jpg\" Width=\"378\" Height=\"378\" UseMap=\"#mapSite\" 
       Border=\"0\" NaturalSizeFlag=\"0\" ALIGN=\"Bottom\" > 
 </DIV>

 <DIV Id=\"SiteMapRed\">
  <IMG Src=\"$image_path/sitelot2.jpg\" Width=\"378\" Height=\"378\" UseMap=\"#mapSite\" 
       Border=\"0\" NaturalSizeFlag=\"0\" ALIGN=\"Bottom\" > 
 </DIV>

 <DIV Id=\"SiteMapGreen\">
  <IMG Src=\"$image_path/sitelot3.jpg\" Width=\"378\" Height=\"378\" UseMap=\"#mapSite\" 
       Border=\"0\" NaturalSizeFlag=\"0\" ALIGN=\"Bottom\" > 
 </DIV>
</DIV>
";

print"
<DIV Id=\"MenuBar\">
  <IMG Src=\"$image_path/menubar.jpg\" width=\"60\" height=\"378\" usemap=\"#menumap\" ismap alt=\"\" border=\"0\" > 
</DIV>
 <map name=\"menumap\">
  <area shape=\"rect\" coords=\"9,45,49,75\"  href=\"$host_URL/index.htm\" >
  <area shape=\"rect\" coords=\"9,109,48,141\"  href=# >
  <area shape=\"rect\" coords=\"11,147,49,177\"  href=\"$html_path/construct$language.htm\" >
  <area shape=\"rect\" coords=\"10,181,50,209\"  href=\"$html_path/historical$language.htm\" >
  <area shape=\"rect\" coords=\"9,246,46,291\"  href=\"$html_path/help$language.htm\" > 
  <AREA SHAPE=\"DEFAULT\" NOHREF>
 </map> 
";

print"
<DIV id=\"myForm\" style=\"position:absolute; width:125px; height:19px; z-index:30; left: 585px; top: 482px\">
  <FORM Name=\"carte\" method =\"post\" >
    <INPUT Type=\"hidden\" Name=\"lot\"></TD>
    <INPUT Type=\"hidden\" Name=\"zoning\">
    <INPUT Type=\"hidden\" Name=\"area\">
    <INPUT Type=\"hidden\" Name=\"toxicity\">
    <INPUT type=\"hidden\" Name=\"history\">
    <INPUT type=\"hidden\" Name=\"language\" Value=$language>
    <INPUT Type=\"submit\" Name = button Value=\"$text[6]\" 
                    onClick = \"return setAction(this.form)\">
  </FORM>
</DIV>
";

## generating map reaction for mouseovers using ALL the data so far...
print "<MAP Name=\"mapSite\">";

$first_index = "[0]" ; 
$second_index = "[1]" ; 
 
for $lot_index (1 .. $last_rectangle) {
 
 $lot_href = "$host_URL/cgi-bin/onelot.pl?$lot_data[$lot_index][0]+$lot_data[$lot_index][1]+$lot_data[$lot_index][2]+$lot_data[$lot_index][3]+$lot_data[$lot_index][4]+$language" ; 
 $lot_href =~ tr/ /_/;

 print"
   <AREA SHAPE=\"rect\" COORDS=\"$coords[$lot_index]\" 
   HREF=\"$lot_href\" 
   onMouseOver=\"mapOver(lot_status$lot_index$first_index, lot_status$lot_index$second_index, L$lot_index); 
   affiche(lot_data$lot_index)\" onMouseOut=\"mapOver(false,false,L$lot_index);\">
 ";
}; 

##for $index (($lots_set_up+1) .. $last_rectangle) {
## print"
##   <AREA SHAPE=\"rect\" COORDS=\"$coords[$index]\"
##   HREF=\"#\" onMouseOver=\"mapOver(true,true,L$index); 
##   affiche(aa)\" onMouseOut=\"mapOver(false,false,L$index);\">
## ";
##};

for $lot_index (($last_rectangle+1) .. $last_lotnumber) {
 $lot_href = "$host_URL/cgi-bin/onelot.pl?$lot_data[$lot_index][0]+$lot_data[$lot_index][1]+$lot_data[$lot_index][2]+$lot_data[$lot_index][3]+$lot_data[$lot_index][4]+$language" ; 
 $lot_href =~ tr/ /_/;

 print"
   <AREA SHAPE=\"polygon\" COORDS=\"$coords[$lot_index]\"
   HREF=\"$lot_href\" onMouseOver=\"mapOver(lot_status$lot_index$first_index, lot_status$lot_index$second_index, L$lot_index); 
   affiche(lot_data$lot_index)\" onMouseOut=\"mapOver(false,false,L$lot_index);\">
 ";
};

print"</MAP>
<layer name=\"layerLotText\" top=251 left=145 width=100 height=20>
<HTML><BODY></BODY></HTML></layer>
<layer name=\"layerZoningText\" top=307 left=145 width=100 height=20>
<HTML><BODY></BODY></HTML></layer>
<layer name=\"layerAreaText\" top=363 left=145 width=100 height=20>
<HTML><BODY><FONT SIZE=5></BODY></HTML></layer>
<layer name=\"layerResidueText\" top=416 left=145 width=100 height=20>
<HTML><BODY><FONT SIZE=5></BODY></HTML></layer>
<layer name=\"layerHistoryText\" top=485 left=143 width=360 height=20>
<HTML><BODY><FONT SIZE=5></BODY></HTML></layer>
" ;

## end of html code
print"
</FONT>
</BODY>
</HTML>
";

exit(0);
