//--------------------------------------------------------
// Name    : plants.js
// Language: JavaScript 1.1
// Summary : Defines the Plant List object.
// History : Author--------- Description------------------
// 01/01/05: D.Winn          Created.
// 06/07/09: D.Winn          Added writeFoot() method.
//--------------------------------------------------------

// ----- Constructor method for a plant list.
function PlantList(date)
{
 // ----- Attributes
 this.curCommonName = "";
 this.curID = "";
 this.curIndex = -1;
 this.family = new Array(0);
 this.lastUpDate = date;
 this.nextIndex = -1;
 this.prevIndex = -1;
 this.plant = new Array(0);
 this.plantCount = 0;
 this.searchFamily = getSearchValue("fid");
 if  (this.searchFamily == "")
     this.searchFamily = "ALL";
 this.searchFind = getSearchValue("f").replChar("'","").replChar("-"," ");
 this.searchMoNative = getSearchValue("n");
 if  (this.searchMoNative != 'Y' && this.searchMoNative != 'N')
     this.searchMoNative = 'B';
 this.searchPicsOnly = getSearchValue("p");
 if  (this.searchPicsOnly != 'Y' && this.searchPicsOnly != 'N')
     this.searchPicsOnly = 'B';     
 this.sortBy = (getSearchValue("s") == "sn") ? "sn" : "cn"; 
 // ----- Methods
 this.add = _PlantList_add;
 this.addFamily = _PlantList_addFamily;
 this.onLoad = _PlantList_onLoad;
 this.getFamilyCount = _PlantList_getFamilyCount;
 this.getPlantCount = _PlantList_getPlantCount;
 this.print = _PlantList_print;
 this.setID = _PlantList_setID;
 this.sort = _PlantList_sort;
 this.sort_sName = _PlantList_sort_sName;
 this.sort_cName = _PlantList_sort_cName;
 this.write = _PlantList_write;
 this.writeData = _PlantList_writeData; 
 this.writeFoot = _PlantList_writeFoot;
 this.writeLinks = _PlantList_writeLinks;
 return this;
}

// ----- Method to add a Plant Family to the Plant List.
function _PlantList_addFamily(id, scientificName, commonName)
{
 this.family[id] = new _PlantList_family (scientificName, commonName);
}

// ----- Constructor method for a single Family Plant List.
function _PlantList_family(scientificName, commonName)
{
 this.scientificName = scientificName;
 this.commonName = commonName;
 return this;
}

// ----- Method to add a Plant to the Plant List.
function _PlantList_add(id, symbol, commonName, scientificName, varName, familyID, native_MO, status, lastDate, detailsURL, pictureCount)
{
 this.plantCount++;  // Update Plant List total plant count.
 var a = lastDate.split('/');  // Convert input "mm/dd/yyyy" into a date.
 
 lastDate = new Date(a[2],(a[0]-1),a[1]);
 if     (this.lastUpDate < lastDate) // The Plant List "Last Updated" date is the date the most recent plant was updated.
        this.lastUpDate  = lastDate; 
 
 var visible = true;
 // ----- Filter based on seach word(s)
 if    (this.searchFind != "")
 {  
       var s = (commonName + ' ' + scientificName + ' ' + this.varName).toLowerCase().replChar("-' ","");
       var a = this.searchFind.toLowerCase().split(' ');
       var found = false;
       for (var i=0; i < a.length && !found; i++) 
           found = s.indexOf(a[i]) >= 0;
       if  (!found) 
           visible = false;
 }
 // ----- Filter based on plant family.
 if    (this.searchFamily != 'ALL' && this.searchFamily != familyID)
       visible = false;
 // ----- Filter based on Missouri native criteria.
 if    (this.searchMoNative != 'B' && this.searchMoNative != native_MO)
       visible = false;
 // ----- Filter based on seach selecting plants with pictures only.
 if    (    (this.searchPicsOnly == "Y" && pictureCount == 0)
         || (this.searchPicsOnly == "N" && pictureCount >  0))
       visible = false;
 // ----- Only add the plant only if it met the filter criteria.       
 if    (visible)
       this.plant[this.plant.length] = new Plant (id, symbol, commonName, scientificName, varName, familyID, native_MO, status, lastDate, detailsURL, pictureCount);
}

// ----- Constructor method for a single Plant in the Plant List.
function Plant(id, symbol, commonName, scientificName, varName, familyID, native_MO, status, lastDate, detailsURL, pictureCount)
{
 this.id = id;
 this.symbol = symbol;
 this.commonName = commonName;
 this.scientificName = scientificName;
 this.varName = varName; 
 this.familyID = familyID; 
 this.native_MO = native_MO;
 this.status = status;
 
 //var a = lastDate.split('/');
 //this.lastDate = new Date(a[2],(a[0]-1),a[1]);
 this.lastDate = lastDate;
 
 
 this.detailsURL = detailsURL == "Y" ? id + '.html' : 'details.html';
 this.pictureURL = new Array(0);
 for (var i=0; i < pictureCount; i++) 
     this.pictureURL[i] = id + '_' + (i+1) + '.jpg';
 return this;
}


// ----- Method to count the number of familes in the Plant List.
function _PlantList_getFamilyCount()
{
 var r = 0;
 for (var i in this.family) r++;
 return r;
}

// ----- Method to count the plants in the Plant List.
function _PlantList_getPlantCount()
{
 return this.plantCount;
}

// ----- onLoad Method for all Plant List pages.
function _PlantList_onLoad()
{ 
 // ----- Pre-load the "next" and "previous" plant list images in the background.
 if  (document.images)
 {
     if  (this.nextIndex > -1)
     {   // Pre-load next plant image(s).
         this.plant[this.nextIndex].image = new Array;
         for  (var j=0; j < this.plant[this.nextIndex].pictureURL.length; j++)
         {
              this.plant[this.nextIndex].image[j] = new Image();
              this.plant[this.nextIndex].image[j].src = this.plant[this.nextIndex].pictureURL[j];
         }
     }
     if  (this.prevIndex > -1)
     {   // Pre-load previous plant image(s).
         this.plant[this.prevIndex].image = new Array;
         for  (var j=0; j < this.plant[this.prevIndex].pictureURL.length; j++)
         {
              this.plant[this.prevIndex].image[j] = new Image();
              this.plant[this.prevIndex].image[j].src = this.plant[this.prevIndex].pictureURL[j];
         }
     }     
 }
}

// ----- Method to write the plant list for printing.
function _PlantList_print()
{
 this.sort();
 var s = '<DIV ID="plPrint"><H1>South Fork Prairie Plant List</H1>';
 s += '<TABLE border=0 cellspacing=0 cellpadding=0 width="100%">';
 s += '<TR valign="bottom">';
 s += '<TH width=20></TH>';
 s += '<TH align="left" width="40%">Scientific Name</TH>';   
 s += '<TH align="left" width="35%">Common Name(s)</TH>';
 s += '<TH align="center" width="10%">Native</TH>';
 s += '<TH align="left" width="15%">Verified</TH></TR>';
 document.writeln(s); 
 // ----- Rows
 for (var i=0; i < this.plant.length; i++)
 {
   s  = '<TR align="left" valign="baseline">';
   s += '<TD valign="baseline" width=20><IMG SRC="../images/checkbox.gif" alt="_" height=14 width=20></TD>'
   s += '<TD width="40%"><I>' + this.plant[i].scientificName.replChar(",","<BR></I>&nbsp;Synonym: <I>");
   if  (this.plant[i].varName != " ")   
       s += ' var. ' + this.plant[i].varName;
   s += '</I></TD>';
   s += '<TD width="35%">' + this.plant[i].commonName + '</TD>';
   s += '<TD align="center" width="10%">' + (this.plant[i].native_MO == "Y" ? "Yes" : "No") + '</TD>';
   s += '<TD width="15%">' + this.plant[i].lastDate.format('mm/dd/yyyy') + '</TD>';
   s += '</TR>';
   document.writeln(s);
 }
 for (var i=1,s=' '; i <= 10; i++) s += '<TR><TD colspan=5>&nbsp;<BR>&nbsp;</TD></TR>'; // Blank lines
 var d = new Date();
 s += '</TABLE><H3>Printed on ' + d.format('mm/dd/yyyy') + '. Last updated on ' + this.lastUpDate.format('mm/dd/yyyy') +'.</H3></DIV>';
 document.write(s);
 return;
}

// ----- Method to set the "current" plant ID.  Adds "Next and Previou" plant to menu.
function _PlantList_setID(id)
{
 this.curID = id;
 this.sort();
 for  (this.curIndex=0; this.curIndex < this.plant.length && this.plant[this.curIndex].id != this.curID ; this.curIndex++);
 if   (this.curIndex == this.plant.length)
 {
      this.prevIndex = this.curIndex = this.nextIndex = -1;
      this.curCommonName = "";
 }
 else
 {
      this.prevIndex = this.curIndex - 1;
      this.nextIndex = this.curIndex + 1;
      if    (this.prevIndex > -1)
            menu.insert("Plant List","· Previous", ('/plants/' + this.plant[this.prevIndex].detailsURL + '?id=' + this.plant[this.prevIndex].id + '&s=' + this.sortBy + '&n=' + this.searchMoNative + '&p=' + this.searchPicsOnly + '&fid=' + this.searchFamily + '&f=' + this.searchFind), "Click here to view the previous plant in the list");
      if    (this.nextIndex == this.plant.length)
            this.nextIndex = -1;
      else  menu.insert("Plant List","· Next", ('/plants/' + this.plant[this.nextIndex].detailsURL + '?id=' + this.plant[this.nextIndex].id + '&s=' + this.sortBy + '&n=' + this.searchMoNative + '&p=' + this.searchPicsOnly + '&fid=' + this.searchFamily + '&f=' + this.searchFind), "Click here to view the next plant in the list");
      this.curCommonName = this.plant[this.curIndex].commonName;
      if   (this.curCommonName.indexOf(',') > 0)
           this.curCommonName = this.curCommonName.substr(0,this.curCommonName.indexOf(','));
 }
}

// ----- Method to sort the Plant List and reset previous, current and next indices.
function _PlantList_sort()
{
 if  (this.sortBy == "sn")
     this.plant.sort(this.sort_sName);
 else
     this.plant.sort(this.sort_cName);
}

// ----- Method to sort the plant list by common name.
function _PlantList_sort_cName(a,b)
{
 if  (a.commonName < b.commonName) return -1;
 if  (a.commonName > b.commonName) return 1;
 return 0;
}

// ----- Method to sort the plant list by scientific name.
function _PlantList_sort_sName(a,b)
{
 if  (a.scientificName < b.scientificName) return -1;
 if  (a.scientificName > b.scientificName) return 1;
 return 0;
}

// ----- Method to write the plant list in a listing format.
function _PlantList_write()
{
 var s ='<CENTER>'; 
 s += '<FORM name="plantListForm" action="' + document.location + '"> ';
 s += '<INPUT type="hidden" name="s" value="' + this.sortBy + '">';

 s += '<INPUT type="hidden" name="fid" value="ALL">';

 s += '<TABLE class="pl" border=0 cellspacing=0 cellpadding=4 width="100%">';
 s += '<TR align="center" valign="top"><TH class="plHead" colspan=4>South Fork Prairie Plant List</TH></TR>';
 document.writeln(s); 
 // ----- Write the search form 
 s  = '<TR align="left" valign="center">';
 s += '<TH class="plSearch" colspan=3>';
 s += ' <FIELDSET style="border: 1px solid gray"><TABLE class="plSearch" border=0 cellspacing=0 cellpadding=1 width="100%">';
 s += '  <TR><TH width="40%">Search plant names for:</TH><TH width="60%"><INPUT name="f" type="text" width=30 value="' + this.searchFind + '" onFocus="this.select();" onKeyUp="plFormChange();return false;"></TH></TR>';


// s += '  <TR><TH width="40%">List plants in this family:</TH><TH width="60%"><SELECT name="fid"><OPTION value="ALL"' + (this.searchFamily == "ALL" ? ' selected' : '') + '>----- include all plant families -----</OPTION>';
// for (var id in this.family) 
// {
//   s += '<OPTION value="' + id + '"' + (this.searchFamily == id ? ' selected>' : '>') + this.family[id].scientificName + ' (' + this.family[id].commonName + ')</OPTION>';
// }
// s += '</SELECT></TH></TR>';
 s += '<TR><TH width="40%">Only list plants that are:</TH><TH width="60%">';
 s += ' <INPUT type="RADIO" title="Check this radio button and click '+ "'" + 'Search' + "'" +  ' to list only plants native to Missouri." name="n" id="nY" value="Y"' + ((this.searchMoNative=='Y') ? ' checked ' : ' ') + '><LABEL for="nY">Native</LABEL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
 s += ' <INPUT type="RADIO" title="Check this radio button and click '+ "'" + 'Search' + "'" +  ' to list only plants that are not native to Missouri." name="n" id="nN" value="N"' +   ((this.searchMoNative=='N') ? ' checked ' : ' ')     + '><LABEL for="nN">Non-native</LABEL> &nbsp;&nbsp;';
 s += ' <INPUT type="RADIO" title="Check this radio button and click '+ "'" + 'Search' + "'" +  ' to list both native and non-native plants." name="n" id="nB" value="B"' + ((this.searchMoNative=='B') ? ' checked ' : ' ') + '><LABEL for="nB">Either</LABEL></TH></TR>';
 s += '<TR><TH width="40%">Only list plants that have:</TH><TH width="60%">';
 s += ' <INPUT type="RADIO" title="Check this radio button and click '+ "'" + 'Search' + "'" +  ' to list only plants that have a picture." name="p" id="pY" value="Y"' + ((this.searchPicsOnly =='Y') ? ' checked ' : ' ') + '><LABEL for="pY">Pictures</LABEL> &nbsp;&nbsp;';
 s += ' <INPUT type="RADIO" title="Check this radio button and click '+ "'" + 'Search' + "'" +  ' to list only plants without a picture." name="p" id="pN" value="N"' + ((this.searchPicsOnly == 'N') ? ' checked ' : ' ') + '><LABEL for="pN">No picture</LABEL> &nbsp;&nbsp;';
 s += ' <INPUT type="RADIO" title="Check this radio button and click '+ "'" + 'Search' + "'" +  ' to list plants with or without picture." name="p" id="pB" value="B"' + ((this.searchPicsOnly == 'B') ? ' checked ' : ' ') + '><LABEL for="pB">Both</LABEL></TH></TR></TABLE></FIELDSET></TH>';
 //s += '<TH class="plColHead" style="border-left: 1px solid gray">';
 s += '<TH class="plColHead">';
 s += '<INPUT type="SUBMIT" title="Click here to search the Plant List" value="Search">';
 if    (this.plant.length != this.plantCount)
       s += '<BR> - or - <BR><INPUT type="SUBMIT" title="Click here to clear the search and list all plants" value="Display All" onClick="plantListForm.f.value=\'\';plantListForm.fid.value=\'ALL\';plantListForm.n[2].checked=true;plantListForm.p[2].checked=true;return true;">';
 s += '</TH></TR>'; 
 s += '<TR><TH class="plSearch" colspan=4><HR size=1></TH></TR>'; 
 document.writeln(s); 
 // ----- Write the search results 
 s = '<TR><TH class="plSubHead" colspan=4><CENTER>';
 switch (this.plant.length)
 {
   case   this.plantCount: s += '<SPAN style="color:#360">All ' + this.plant.length + ' plants listed.</SPAN>';
   break;
   case   0:               s += '<SPAN style="color:#f00">No plants found using this search criteria.</SPAN>';
   break;        
   default:                s += '<SPAN style="color:#360">(' + this.plant.length + ' out of '  + this.plantCount + ' plants found)</SPAN>';
 }
 s += '</CENTER></TH></TR>';        
 document.writeln(s); 
 if   (this.plant.length > 0)
 {
   // ----- Column headings 
   s  = '<TR valign="bottom">';
   s += '<TH class="plColHead" width="60">Thumb<BR>nail</TH>';
   s += '<TH class="plColHead" width="45%">Common Name';
   s += '<BR><INPUT type="SUBMIT"  title="Click here to sort by Common Name" value="Sort by Common Name"" onClick="document.forms.plantListForm.s.value=\'cn\';return true;"></TH>';
   s += '<TH class="plColHead" width="45%">Scientific Name';
   s += '<BR><INPUT type="SUBMIT" title="Click here to sort by Scientific Name" value="Sort by Scientific Name" onClick="document.forms.plantListForm.s.value=\'sn\';return true;"></TH>';
   s += '<TH class="plColHead" width="5%">Missouri<br>Native?</TH></TR><TBODY ID="plTBody">';
   document.writeln(s); 
   // ----- Rows
   for (var i=0,t10=0,a=' '; i < this.plant.length; i++)
   {
        t10 = 1 - t10; // Alternate (toggle) between 1 and 0 for row shading.
        a = '<A name="' +  this.plant[i].id + '" HREF="' + this.plant[i].detailsURL  + '?id=' + this.plant[i].id + '&s=' + this.sortBy + '&n=' + this.searchMoNative + '&p=' + this.searchPicsOnly + '&fid=' + this.searchFamily +  '&f=' + this.searchFind + '" onMouseOver="return msg(\'Click here to view more details about this plant.\');" onMouseOut="return msg();" title="Click here to view more details about this plant">';
        s = '<TR align="left" valign="baseline">';
        s += '<TD class="plRow' + t10 + '" valign="top" width="60">';
        if   (this.plant[i].pictureURL.length > 0)
             s += a + '<IMG SRC="' + this.plant[i].id + '_tn.jpg" border=0></A></TD>';
        else s += '&nbsp;</TD>';
        s += '<TD class="plRow' + t10 + '" width="45%">' + a;
        s += this.plant[i].commonName.replChar(",",",<BR>")  + '</A></TD>';
        s += '<TD class="plRow' + t10 + '" width="45%"><I>' + this.plant[i].scientificName.replChar(",","<br></I>Synonym: <I>");
        if  (this.plant[i].varName != " ")   
            s += ' var. ' + this.plant[i].varName;
        s += '</I></TD>';
        s += '<TD class="plRow' + t10 + '" align="center" width="5%">' + (this.plant[i].native_MO == "Y" ? "Yes" : "No") + '</TD></TR>';
        document.writeln(s);
   }
 }
 s = '</TBODY></TABLE></FORM></CENTER>';
 document.write(s);
 return;
}

// ------ Write the common data for a plant detail page.
function _PlantList_writeData()
{
 var i = this.curIndex;
 var s = '<TABLE align="top" border=0 cellpadding=0 cellspacing=0 width="100%"><TR valign="top"><TD width="60%">';
 s += '<TABLE align="left" border=1 cellpadding=0 cellspacing=0 width="100%"><TR><TD>';
 s += '<TABLE border=0 cellspacing=0 cellpadding=4 valign="top" width="100%">';
 s += '<TR valign="top">';
 s += '<TD class="plSubHead" width="30%">Common Name' + (this.plant[i].commonName.indexOf(',') > 0 ? "s" : " ") + "</TD>";
 s += '<TD class="plRow0">' + this.plant[i].commonName.replChar(",",",<br>")  + '</TD></TR>';
 s += '<TR valign="top">';
 s += '<TD class="plSubHead">Scientific Name</TD>'; 
 s += '<TD class="plRow0"><I>' + this.plant[i].scientificName.replChar(",","<br></I>Synonym: <I>");
 if  (this.plant[i].varName != " ")   
     s += ' var. ' + this.plant[i].varName;
 s += '</I></TD></TR>';
 s += '<TR valign="top">';
 s += '<TD class="plSubHead" align="left" width="30%">Family</TD>';
 s += '<TD class="plRow0">' + this.family[this.plant[i].familyID].scientificName + ' (' + this.family[this.plant[i].familyID].commonName + ')</TD></TR>'; 
 s += '<TR valign="top">';
 s += '<TD class="plSubHead" align="left">Missouri Native?</TD>'; 
 s += '<TD class="plRow0">' + (this.plant[i].native_MO == "Y" ? "Yes" : "No") + '</TD></TR>';
 if  (this.plant[i].status != " ")   
 {
     s += '<TR valign="top">';
     s += '<TD class="plSubHead" align="left">Special Status</TD>'; 
     s += '<TD class="plRow0">' + this.plant[i].status + '</TD></TR>';
 }
 s += '<TR valign="top">';
 s += '<TD class="plSubHead" align="left">Last Verified</TD>'; 
 s += '<TD class="plRow0">' + this.plant[i].lastDate.format() + '</TD></TR>'; 
 s += '<TR valign="top">';
 s += '<TD class="plSubHead" align="left" width="30%">Symbol</TD>';
 s += '<TD class="plRow0">' + this.plant[i].id  + '</TD></TR>';
 s += '</TABLE></TD></TR></TABLE></TD>';
 s += '<TD width="40%"><IMG class="img1" src=';
 if   (this.plant[i].pictureURL.length == 0)
      s += '"noPicture.gif" alt="No picture available">'; 
 else s += '"' + this.plant[i].pictureURL[0] + '" alt="Picture of ' + this.curCommonName + '" title="' + this.curCommonName +  '">';
 s += '</TD></TR></TABLE>';
 document.writeln(s);
 document.close();
}


// ----- Write the common footer at the bottom of a plant page.
function _PlantList_writeFoot()
{
 d = new Date(Date.parse(document.lastModified));
 if      (pl.plant[pl.curIndex].lastDate > d)   
         writeFoot(pl.plant[pl.curIndex].lastDate);
 else    writeFoot();
}


// ----- Write the common hyperlinks at the bottom of a plant page.
function _PlantList_writeLinks()
{
 var sb = this.sortBy == "sn" ? "scientific" : "common";
 var s = '<BR style="clear: both">';
 s += '<P>For additional information on ' + this.curCommonName + ' visit the <A HREF="http://plants.usda.gov/java/profile?symbol=' + this.curID + '" onMouseOver="return msg(\'Click here to link to the National Plant Data Center web site.\')" outMouseOut="return msg()" title="Click here to link to the National Plant Data Center web site." >National Plant Data Center</A></P>';
 s += '<TABLE border=0 cellspacing=0 cellpadding=4 width="100%">';
 s += '<TR valign="bottom"><TD align="left" class="plLinks" width="30%">';
 if   (this.prevIndex == -1)
      s += '&nbsp;</TD>';
 else
 {
      var msg = 'Click here to view the previous plant, sorted by ' + sb + ' name'; 
      pl_bh.add("bn_previous",msg);
      s += '<A HREF="'  + this.plant[this.prevIndex].detailsURL  + '?id=' + this.plant[this.prevIndex].id + '&s=' + this.sortBy + '&n=' + this.searchMoNative + '&p=' + this.searchPicsOnly + '&fid=' + this.searchFamily + '&f=' + this.searchFind + '" onMouseOver="return pl_bh.over(\'bn_previous\')" onMouseOut="return pl_bh.out(\'bn_previous\')"><IMG src="../images/bn_previous_n.gif" alt="< Previous" border="0" height="32" name="bn_previous" title="' + msg + '" width="120"></A></TD>';
 }
 pl_bh.add("bn_pl","Click here to view the plant list.");
 s += '<TD align="center" class="plLinks" width="40%"><A HREF="plants.html?s=' + this.sortBy + '&n=' + this.searchMoNative + '&p=' + this.searchPicsOnly + '&fid=' + this.searchFamily + '&f=' + this.searchFind + '" onMouseOver="return pl_bh.over(\'bn_pl\')" onMouseOut="return pl_bh.out(\'bn_pl\')"><IMG src="../images/bn_pl_n.gif" alt="Plant List" border="0" height="32" name="bn_pl" title="Click here to view the plant list." width="120"></A></TD>';
 s += '<TD align="right" class="plLinks" width="30%">';
 if   (this.nextIndex == -1) 
      s += '&nbsp;</TD>';
 else 
 {
      var msg = 'Click here to view the next plant, sorted by ' + sb + ' name'; 
      pl_bh.add("bn_next",msg);
      s += '<A HREF="' + this.plant[this.nextIndex].detailsURL + '?id=' + this.plant[this.nextIndex].id + '&s=' + this.sortBy + '&n=' + this.searchMoNative + '&p=' + this.searchPicsOnly + '&fid=' + this.searchFamily + '&f=' + this.searchFind + '" onMouseOver="return pl_bh.over(\'bn_next\')" onMouseOut="return pl_bh.out(\'bn_next\')"><IMG src="../images/bn_next_n.gif" alt="Next >" border="0" height="32" name="bn_next" title="' + msg + '" width="120"></A></TD>';
 }
 s += '</TR>';
 s += '<TR><TD COLSPAN=3 align="center" class="plLinks">Plant list sorted by ' + sb + ' name.';
 if  (this.searchMoNative != 'B' || this.searchFamily != 'ALL' || this.searchPicsOnly != 'B') 
 {
     s += ' Limited to';
     if  (this.searchMoNative != 'B')   
         s += (this.searchMoNative == 'N' ? ' non-': ' ') + 'native';
     s += ' plants' + (this.searchFamily != 'ALL' ? ' in the ' + this.family[this.searchFamily].scientificName + ' family' : '');
     if  (this.searchPicsOnly != 'B')  
          s += (this.searchPicsOnly == 'Y' ? ' with ': ' without ') + ' a picture';
     s += '.';
 }
 if  (this.searchFind != "")   
 {
     var a = this.searchFind.split(" ");
     s += '<BR>Using the search word' + ((a.length > 1) ? 's' : ' ') + ':&nbsp;&nbsp;' + this.searchFind;
 }       
 s += '</TD></TR></TABLE>'; 
 document.writeln(s); 
 document.close();
}