if (!Array.prototype.indexOf) {
  Array.prototype.indexOf = function (obj, fromIndex) {
    if (fromIndex == null) {  fromIndex = 0;  }
    else if (fromIndex < 0) {  fromIndex = Math.max(0, this.length + fromIndex);  }
    for (var i = fromIndex; i < this.length; i++) {  if (this[i] === obj) return i;  }
    return -1;  };
  }

var jlinks = new Array();
var _g_zip = "";
var hostName = '.treedazzled.com';
var previewing = 0;
var weekday = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var month = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");

jlinks["Molecular Breeding"] = "http://www.kluweronline.com/issn/1380-3743/contents";
jlinks["Theoretical and Applied Genetics"] = "http://link.springer-ny.com/link/service/journals/00122/";
jlinks["Sexual Plant Reproduction"] = "http://link.springer.de/link/service/journals/00497/index.htm";
jlinks["American Journal of Enology and Viticulture"] = "http://www.ajevonline.org/";
jlinks["Journal of Biosciences (Bangalore)"] = "http://www.ias.ac.in/jbiosci/contents.htm";
jlinks["Journal of Tropical Ecology"] = "http://journals.cambridge.org/action/displayJournal?jid=TRO";
jlinks["Journal of Forest Research"] = "http://www.springerlink.com/openurl.asp?genre=journal&issn=1341-6979";
jlinks["Wilson Bulletin"] = "http://www.ummz.lsa.umich.edu/birds/wilsonbull.html";
jlinks["Seed Science Research"] = "http://www.cabi-publishing.org/Journals.asp?SubjectArea=&PID=24";
jlinks["Environmental Management"] = "http://link.springer-ny.com/link/service/journals/00267/";
jlinks["Weed Technology"] = "http://wssa.allenpress.com/wssaonline/?request=get-archive";
jlinks["Silvae Genetica"] = "http://www.bfafh.de/inst2/sg-elfis.htm";
jlinks["In Vitro Cellular &amp; Developmental Biology - Plant"] = "http://www.ingentaconnect.com/content/cabi/ivp";
jlinks["Journal of Environmental Science &amp; Health Part A-Toxic/Hazardous Substances &amp; Environmental Engineering"] = "http://www.tandf.co.uk/journals/titles/10934529.asp";
jlinks["Mycological Research"] = "http://journals.cambridge.org/action/displayJournal?jid=MYC";
jlinks["Annals of Botany (London)"] = "http://aob.oxfordjournals.org/";
jlinks["Journal of the Korean Society for Horticultural Science"] = "http://www.horticulture.or.kr/eng/";
jlinks["Journal of Plant Protection Research"] = "http://www.ior.poznan.pl/Journal/";
jlinks["Canadian Journal of Botany"] = "http://pubs.nrc-cnrc.gc.ca/cgi-bin/rp/rp2_vols_e?cjb";
jlinks["Research Note - Pacific Northwest Research Station, USDA Forest Service"] = "http://www.fs.fed.us/pnw/publications/rns.shtml";
jlinks["Western North American Naturalist"] = "http://www.lib.byu.edu/spc/wnan/";
jlinks["Journal of the American Society for Horticultural Science"] = "http://www.electronicipc.com/JournalEZ/toc.cfm?code=0420001";
jlinks["Trends in Plant Science"] = "http://www.sciencedirect.com/science/journal/13601385";
jlinks["Journal of General Plant Pathology"] = "http://link.springer.de/link/service/journals/10327/index.htm";
jlinks["Remote Sensing of Environment"] = "http://www.sciencedirect.com/science/journal/00344257";
jlinks["Journal of Mammalogy"] = "http://www.asmjournals.org/";
jlinks["Journal of Virological Methods"] = "http://www.sciencedirect.com/science/journal/01660934";
jlinks["Electromagnetic Biology &amp; Medicine"] = "http://journalsonline.tandf.co.uk/openurl.asp?genre=journal&issn=1536-8378";
jlinks["Transactions of the Illinois State Academy of Science"] = "http://www.il-st-acad-sci.org/transactions/transac.html";
jlinks["Zeitschrift fur Naturforschung C-A Journal of Biosciences"] = "http://www.znaturforsch.com/c.htm";
jlinks["Transactions of the Kansas Academy of Science"] = "http://www.emporia.edu/kas/transact.htm";
jlinks["Theoretical &amp; Applied Genetics"] = "http://link.springer-ny.com/link/service/journals/00122/";
jlinks["Western Journal of Applied Forestry"] = "http://www.ingentaconnect.com/content/saf/wjaf";
jlinks["Agronomy Journal"] = "http://agron.scijournals.org/";
jlinks["Phytoparasitica"] = "http://www.phytoparasitica.org/";
jlinks["Scientia Horticulturae (Amsterdam)"] = "http://www.sciencedirect.com/science/journal/03044238";
jlinks["Tree Physiology"] = "http://heronpublishing.com/tphome.html";
jlinks["Weed Science"] = "http://www.bioone.org/bioone/?request=get-archive&issn=0043-1745";
jlinks["Journal of Experimental Botany"] = "http://jxb.oxfordjournals.org/";
jlinks["Annales Botanici Fennici"] = "http://www.sekj.org/AnnBot.html";
jlinks["Journal of Arid Environments"] = "http://www.sciencedirect.com/science/journal/01401963";
jlinks["Global Ecology &amp; Biogeography"] = "http://www.ingentaconnect.com/content/bsc/geb";
jlinks["Journal of Integrative Plant Biology"] = "http://www.chineseplantscience.com/";
jlinks["Australian Journal of Experimental Agriculture"] = "http://www.publish.csiro.au/nid/72.htm";
jlinks["European Journal of Horticultural Science"] = "http://www.gartenbauwissenschaft.de/";
jlinks["Planta (Berlin)"] = "http://www.springerlink.com/app/home/journal.asp?wasp=806ebfc9907a47dc97171ea15a012e0b&referrer=parent&backto=linkingpublicationresults,1:100484,1";
jlinks["Plant Protection Science"] = "http://www.cazv.cz/2003/anglicka/e-publikace/ochr.htm";
jlinks["Behavioral Ecology &amp; Sociobiology"] = "http://link.springer-ny.com/link/service/journals/00265/";
jlinks["Scandinavian Journal of Forest Research"] = "http://www.ingentaconnect.com/content/02827581";
jlinks["Arboricultural Journal"] = "http://www.trees.org.uk/journal.php";
jlinks["Forestry"] = "http://forestry.oupjournals.org/";
jlinks["Canadian Journal of Forest Research"] = "http://pubs.nrc-cnrc.gc.ca/cgi-bin/rp/rp2_desc_e?cjfr";
jlinks["Forest Ecology &amp; Management"] = "http://www.sciencedirect.com/science/journal/03781127";
jlinks["Science"] = "http://www.sciencemag.org/";
jlinks["American Journal of Botany"] = "http://www.amjbot.org/";
jlinks["HortTechnology"] = "http://www.ashs.org/horttech/";
jlinks["Biochemical Systematics &amp; Ecology"] = "http://www.sciencedirect.com/science/journal/03051978";


function forumFormatDate(d) {

  var hours = d.getHours() ? ((d.getHours() < 13) ? d.getHours() : (d.getHours() - 12)) : 12;
  var minutes = (d.getMinutes() < 10) ? ("0" + d.getMinutes()) : d.getMinutes();
  var ampm = (d.getHours() < 12) ? "AM" : "PM";
  
  return (weekday[d.getDay()] + ", " + month[d.getMonth()] + " " + d.getDate() + " " + hours + ":" + minutes + " " + ampm);  }

function tdProcessData(f) {
  if (!f.author.value.match(/\w/)) return 1;
  // if (!f.email.value.match(/^\S+@\S+$/)) return 2;
  if (!f.text.value.match(/\w/)) return 3;
  return 0;  }

function tdEscape(s) {
  s = s.replace(/&/g, "&amp;");
  s = s.replace(/</g, "&lt;");
  return s;  }

function tdParagraphize(s) {
  s = s.replace(/^\s*/, "<p>");
  s = s.replace(/\s*$/, "</p> ");
  s = s.replace(/[\r\n]+/g, "</p><p>");
  return s;
  }

function tdGeneratePreviewHTML(f) {
  var now = new Date();
  var emailhtml = f.email.value ? "<a rel=\"nofollow\" href=\"&#109;&#97;&#105;&#108;&#116;&#111;&#58;" + escape(f.email.value) + "\">" + f.author.value + "</a>" : f.author.value;
  return "<a id=\"blah\"></a>" + tdParagraphize(tdEscape(f.text.value)) + ifExistsLinkProvided(f.url.value) + "<p class=\"posted\">Posted by: " + emailhtml + " | " + forumFormatDate(now) + "</p>";  }

function tdPreview(e) {
  if (previewing) {
    e.value = " Preview ";
    document.getElementById("previewdiv").className = "displaynone";
    document.getElementById("formdiv").className = "displayblock";
    previewing = 0;  }
  else {
    theForm = e.form;
    var resultCode = tdProcessData(theForm);
    if (!resultCode) {
      var previewdiv = document.getElementById("previewdiv");
      previewdiv.innerHTML = tdGeneratePreviewHTML(theForm);
      e.value = " Edit ";
      document.getElementById("formdiv").className = "displaynone";
      previewdiv.className = "displaygreenbg";
      previewing = 1;  }
    else {
      switch (resultCode) {
        case 1: alert("You must provide a name or online \"handle\"."); break
        case 2: alert("You must provide an e-mail address.  The address will not be displayed or provided to others."); break
        case 3: alert("Please provide some comments!"); break
        default: alert("There is a problem with your submission.  Please try to provide other values.");  }  }  }  }

function tdDisableButton(e) {
  if (!requestSubmitted) {
    theForm = e.form;
    var resultCode = tdProcessData(theForm);
    if (!resultCode) {
      e.disabled = true;
      requestSubmitted = true;
      theForm.text.value = tdEscape(theForm.text.value);
      if (theForm.bakecookie.checked) rememberMe(theForm);
      else forgetMe();
      setTimeout('submitIt()', 250);  }
    else {
      switch (resultCode) {
        case 1: alert("You must provide a name or online \"handle\"."); break
        case 2: alert("You must provide an e-mail address.  The address will not be displayed or provided to others."); break
        case 3: alert("Please provide some comments!"); break
        default: alert("There is a problem with your submission.  Please try to provide other values.");  }  }  }
  else {  return false;  }  }

function handleYourCountryChange() {

  var ycinput = document.getElementById("yourcountry");
  var vl = ycinput.options[ycinput.selectedIndex].value;

  if (vl != 'other') {
    var now = new Date();
    now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
    setCookie('country', vl, now);
    switchAmazonLinks(vl);  }  }

function countryLink() {

  var val = getCookie('country');
  var bookPageTitles = new Array('TreeDazzled: Books', 'TreeDazzled: Best Sellers', 'TreeDazzled: Native Books', 'TreeDazzled: P. Allen Smith', 'TreeDazzled: Jerry Baker', 'TreeDazzled: Fuchsia Books');

  if (val) {
    if (val == 'uk') {  switchAmazonLinks('uk');  }  }
  else if (document.referrer && document.referrer.match(/\.uk/)) {
    var now = new Date();
    now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
    setCookie('country', 'uk', now);
    val = 'uk';
    switchAmazonLinks('uk');  }
  else addOnclickToAmazonLinks();
  if (bookPageTitles.indexOf(document.title) > -1) {
    var label = document.createElement("label");
    label.setAttribute("for", "yourcountry");
    label.style.cssText = 'display: inline;';
    label.appendChild(document.createTextNode("Your country: "));
    var select = document.createElement("select");
    select.setAttribute("id", "yourcountry");
    select.onchange = handleYourCountryChange;
    var choices = new Array('US', 'UK', 'Other');
    var option;
    for (var i = 0; i < choices.length; i++) {
      option = document.createElement("option");
      option.appendChild(document.createTextNode(choices[i]));
      option.setAttribute("value", choices[i].toLowerCase());
      select.appendChild(option);
      }
    var i;
    val = val ? val : 'other';
    for (i = 0; i < select.options.length; i++) {  if (select.options[i].value == val) break;  }
    select.selectedIndex = i;
    var interiordiv = document.createElement("div");
    if (val == 'other') interiordiv.className = 'tdlink';
    interiordiv.setAttribute('id', 'interiorcmenudiv');
    interiordiv.appendChild(label);
    interiordiv.appendChild(select);
    var cmenudiv = document.createElement("div");
    cmenudiv.className = 'sidebar';
    cmenudiv.style.cssText = 'padding-top: 0px;';
    cmenudiv.appendChild(interiordiv);
    var leftdiv = document.getElementById('left');
    var els = leftdiv.getElementsByTagName('div');
    els[0].style.cssText = 'padding-bottom: 0px;';
    leftdiv.insertBefore(cmenudiv, els[0].nextSibling);
    }
  }

function intensifyMenu() {
  if (!getCookie('country')) {
    document.getElementById('interiorcmenudiv').className = 'menuintensified';
    var ycinput = document.getElementById("yourcountry");
    var i;
    for (i = 0; i < ycinput.options.length; i++) {  if (ycinput.options[i].value == 'us') break;  }
    ycinput.selectedIndex = i;
    var date = new Date();
    var curDate = null;
    do {  var curDate = new Date();  }
    while((curDate - date) < 120);  }  }

function addOnclickToAmazonLinks() {
  for (var j = 0; j < document.links.length; j++) {
    if (document.links[j].href.match(/amazon/)) {
      document.links[j].onclick = intensifyMenu;
      }  }  }

function switchAmazonLinks(country) {

  var amazonExp;
  var idExp;
  var amazonSite;
  var id;

  if (country == 'uk') {
    amazonExp = /amazon\.com/;
    idExp = /treedazzled-20/;
    amazonSite = 'amazon.co.uk';
    id = 'treedazzled-21';
    }
  else if (country == 'us') {
    amazonExp = /amazon\.co\.uk/;
    idExp = /treedazzled-21/;
    amazonSite = 'amazon.com';
    id = 'treedazzled-20';
    }
  for (var j = 0; j < document.links.length; j++) {
    if (document.links[j].href.match(amazonExp)) {
      var oldlink = document.links[j].href;
      oldlink = oldlink.replace(amazonExp, amazonSite);
      oldlink = oldlink.replace(idExp, id);
      document.links[j].href = oldlink;  }
    }
  for (var j = 0; j < document.forms.length; j++) {
    if (document.forms[j].action.match(amazonExp)) {
      var oldaction = document.forms[j].action;
      oldaction = oldaction.replace(amazonExp, amazonSite);
      document.forms[j].action = oldaction;
      oldaction = document.forms[j].tag.value;
      oldaction = oldaction.replace(idExp, id);
      document.forms[j].tag.value = oldaction;  }
    }
  }
  
function fixTagLinks() {
  for (var j = 0; j < document.links.length; j++) {
    if ((document.links[j].parentNode.className == "tags") && document.links[j].href.match(/technorati\.com\/tag\//)) {
      var oldlink = document.links[j].href;
      oldlink = oldlink + "?from=www.treedazzled.com";
      document.links[j].href = oldlink;  }  }  }

function switchPhotoLinks() {

  var photoExp = /http:\/\/www\.treedazzled\.com\/photos\//;

  for (var j = 0; j < document.links.length; j++) {
    if (document.links[j].href.match(photoExp)) {
      var oldlink = document.links[j].href;
      oldlink = oldlink.replace(photoExp, 'http://www.treedazzled.com/treedazzled/gallery.htm?');
      document.links[j].href = oldlink;  }
    }
  }

function jlink(title) {
  if (jlinks[title]) document.write("<a href=\"" + jlinks[title] + "\">");
  document.write(title + "</a>");  }

function ifExistsWriteInParens(s) {  if (s) document.write(" (" + s + ")");  }

function ifExistsWriteLinkProvided(s) {  if (s) document.write("<p>Link provided: <a href=\"" + s + "\">" + s + "</a></p>");  }

function ifExistsLinkProvided(s) {
  if (s) return "<p>Link provided: <a href=\"" + s + "\">" + s + "</a></p>";
  else return "";  }

function setCookie (name, value, expires) {
    document.cookie = name + '=' + escape(value) + '; expires=' + expires.toGMTString() + '; domain=' + hostName + '; path=/';
}

function getCookie (name) {
  var key = name + '=';
  var c = document.cookie;
  var i = c.indexOf(key);
  if (i < 0) return '';
  var j = c.indexOf(';', i + key.length);
  if (j < 0) j = c.length;
  return unescape(c.substring(i + key.length, j));
}

function handleLocaleChange() {

  var wlinput = document.getElementById("weatherlocale");
  var weathertoplink = document.getElementById("weathertoplink");
  var now = new Date();
  var localediv = document.getElementById("localediv");

  now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
  setCookie('country', 'uk', now);
  weathertoplink.href = "http://weather.yahoo.com/";
  var vl = wlinput.options[wlinput.selectedIndex].value;
  setCookie('weatherlocale', vl, now);
  localediv.innerHTML = wcode[vl];
  if (localediv.className == "displaynone") {
    document.getElementById("weatherimg").className = "displaynone";
    localediv.className = "displayblock";
    switchAmazonLinks("uk");  }  }

function ukLocales() {
  if (typeof(wcode) != "undefined") {
    var label = document.createElement("label");
    label.setAttribute("for", "weatherzip");
    label.style.cssText = 'display: inline;';
    label.appendChild(document.createTextNode("UK locale: "));
    var select = document.createElement("select");
    select.setAttribute("id", "weatherlocale");
    select.onchange = handleLocaleChange;
    select.onfocus = function() { if (document.getElementById("localediv").className == "displaynone") handleLocaleChange();  }
    var option;
    for (var i in wcode) {
      if (i != 'indexOf') {
        option = document.createElement("option");
        option.appendChild(document.createTextNode(i));
        option.setAttribute("value", i);
        select.appendChild(option);
        }  }
    var parentForm = document.getElementById("weatherzip").parentNode;
    parentForm.appendChild(document.createElement("br"));
    parentForm.appendChild(label);
    parentForm.appendChild(select);
    }
  }

function setWeather() {

  var country = getCookie('country');
  
  if (country == 'uk') {
    var val = getCookie("weatherlocale");
    var wlinput = document.getElementById("weatherlocale");
    if (typeof(wlinput) != "undefined") {
      if (!val) val = "London";
      var i;
      for (i = 0; i < wlinput.options.length; i++) {  if (wlinput.options[i].value == val) break;  }
      wlinput.selectedIndex = i;
      handleLocaleChange();  }  }
  else {
    var val = getCookie("weatherzip");
    var wzinput = document.getElementById("weatherzip");
    wzinput.value = val ? val : "94122";
    handleZipChange(wzinput);  }  }

function handleZipChange(wzinput) {
  if (!wzinput.value.match(/^\d{5}$/) || ((wzinput.value == _g_zip) && (document.getElementById("weatherimg").className == "displayblock"))) return;
  _g_zip = wzinput.value;
  var weathertoplink = document.getElementById("weathertoplink");
  var weatherlink = document.getElementById("weatherlink");
  var now = new Date();
  now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
  setCookie('country', 'us', now);
  setCookie('weatherzip', _g_zip, now);
  weathertoplink.href = "http://www.wunderground.com/cgi-bin/findweather/getForecast?query=" + _g_zip;
  weatherlink.href = "http://www.4wx.com/weather.php?user=default&theme=default&forecast=zandh&zipcode=" + _g_zip;
  var img = new Image();
  img.zip = _g_zip;
  if (document.getElementById("weatherimg").className == "displaynone") {  switchAmazonLinks("us");  }
  img.onload = function() {
    var weatherimg = document.getElementById("weatherimg");
    weatherimg.src = this.src;
    document.getElementById("localediv").className = "displaynone";
    weatherimg.className = "displayblock";  }
  img.onerror = function() {  if (_g_zip == this.zip) this.src = "http://www.4wx.com/weather.php?config=png&alt=hwivzone&forecast=zone&hwvtc=333333&hwvbg=white&zipcode=" + _g_zip + "&daysonly=1&maxdays=7";  }
  img.src = "http://www.4wx.com/weather.php?config=png&alt=hwivzone&forecast=zone&hwvtc=333333&hwvbg=white&zipcode=" + _g_zip + "&daysonly=1&maxdays=7";  }
<!-- ph=1 -->
<!-- nhm:from_kauri -->
