/******************************
 *
 * GLOBAL VARIABLES
 *
 *
 *****************************/

WEBSITE= "absinthefever.com";
SHOW_CENTURY= 1; // see functions absinthe() and century()

/******************************
 *
 * ROBOT REPLAY
 *
 *
 *****************************/

// document.write( '<script type="text/javascript" src="http://static.robotreplay.com/nitobi.replay.js"></script>');

/******************************
 *
 * TOP-LEVEL NAVIGATION
 *
 *
 *****************************/

function butterfly( butterflyNumber, visibleOrHidden) {
  // called onmouseover and onmouseout
  document.getElementById( "tNvBfly" + butterflyNumber).style.visibility= visibleOrHidden;
}

function init_tNv( currentTab) {
  
  var FOUR= 3;  // Four top-level links? or just 3? Review this whole function to understand this.
  
  //
  // Create the "butterflies" block of HTML
  //

  // Set the x-coordinate of each of the four butterflies (absolute within <div id="tNv"> )
  
  //---Uncomment the following line to enable Launch 9 Navi:
  // var butterflyPos= new Array( 0, 16, 206, 401, 498); // <-- element 0 is void; we start from 1
  //---Also delete the following line to enable Launch 9 Navi:
  var butterflyPos= new Array( 0, 16, 206, 395, 498); // <-- element 0 is void; we start from 1
  
  // Build the HTML
  var butterflies= "";
  for( var i=1; i<=FOUR; i++) {
    butterflies +=
        '<img id="tNvBfly'
      + i // id
      + '" style="position: absolute; left: '
      + butterflyPos[i] // pixels
      + 'px; top: 0px; visibility: hidden" src="/img/tNv_bfly.gif" alt="Come fly with absinthe...">';
  }
  
  //
  // Vertical lines (dividers) between links
  //
  
  // Set the x-coordinate of each of the three lines
  
  //---Uncomment the following line to enable Launch 9 Navi:
  // var vertLinePos= new Array( 0, 75, 265, 461); // <-- element 0 is void; we start from 1
  //---Also delete the following line to enable Launch 9 Navi:
  var vertLinePos= new Array( 0, 75, 265, 455); // <-- element 0 is void; we start from 1
  
  var vertLine= new Array();
  for( var i=1; i<=FOUR-1; i++) {
    vertLine[i]=
        '<img style="position: absolute; left: '
      + vertLinePos[i]
      + 'px; top: 40px" src="/img/tNv_vl.gif" alt="">';
  }
  
  //
  // Links
  //
  
  // Set the x-coordinate of each of the four links, and their href and title attributes
  
  //---Uncomment the following line to enable Launch 9 Navi:
  // var linkPos=   new Array( 0, 19, 87, 278, 473); // <-- element 0 is void; we start from 1
  //---Also delete the following line to enable Launch 9 Navi:
  var linkPos=   new Array( 0, 19, 87, 278, 467); // <-- element 0 is void; we start from 1
  
  // ---!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!---
  // var linkHref=  new Array( "", "/", "/absinthe", "/buy-absinthe", "/contact");
  // var linkTitle= new Array( "", "Home", "All about absinthe", "Buy absinthe online", "Contact");
  var linkHref=  new Array( "", "/", "/absinthe", "/why", "/feedback");
  var linkTitle= new Array( "", "Home", "All about absinthe", "About this website", "Your feedback");
  
  var link= new Array();
  for( var i=1; i<=FOUR; i++) {
    link[i]=
        '<a id="tNv'
      + i // id
      + '" href="'
      + linkHref[i]
      + '" title="'
      + linkTitle[i]
      + '"><img style="position: absolute; left: '
      + linkPos[i] // pixels
      + 'px; top: 40px" src="/img/tNv_'
      + i // image name
      + '.gif" alt="'
      + linkTitle[i]
      + '"></a>';
  }
  
  //
  // Tabs
  //
  
  // Set the x-coordinate of each of the three tabs 
  var tabPos= new Array( 0, 0, 76, 266, 462); // <-- element 0 is void; we start from 1
                                              //     element 1 is unused (no tab for "home")
  var tab= new Array();
  for( var i=2; i<=FOUR; i++) {
    tab[i]=
        '<img style="position: absolute; left: '
      + tabPos[i]
      + 'px; top: 30px" src="/img/tNv_'
      + i // image name
      + 't.gif" alt="'
      + linkTitle[i]
      + '">';
  }
  
  //
  // Tab bottom borders
  //

  var tabBottomBorder= new Array();
  for( var i=2; i<=FOUR; i++) {
    tabBottomBorder[i]=
        '<img style="position: absolute; left: 0px; top: 79px" src="/img/tNv_'
      + i // image name
      + 'tbb.gif" alt="">';
  }
  
  //
  // F L Y ...
  //
  
  var tNvDiv= document.getElementById( "tNv");
  
  //
  // Reposition <div id="tNv">
  //
  tNvDiv.style.left= "415px";
  tNvDiv.style.top=   "19px";
  
  tNvDiv.innerHTML= butterflies; // always
  
  if( currentTab == 1) {
    tNvDiv.innerHTML += link[1] + vertLine[1] + link[2] + vertLine[2] + link[3]; // + vertLine[3] + link[4];
    if( FOUR == 4) tNvDiv.innerHTML += vertLine[3] + link[4];                    // <--only if FOUR really is 4
  }
  else if( currentTab == 2) {
    tNvDiv.innerHTML += link[1] + tab[2] + tabBottomBorder[2] + link[3]; // + vertLine[3] + link[4];
    if( FOUR == 4) tNvDiv.innerHTML += vertLine[3] + link[4];            // <--only if FOUR really is 4
    butterfly( "2", "visible");
  }
  else if( currentTab == 3) {
    tNvDiv.innerHTML += link[1] + vertLine[1] + link[2] + tab[3] + tabBottomBorder[3]; // + link[4];
    if( FOUR == 4) tNvDiv.innerHTML += link[4];                                        // <--only if FOUR really is 4
    butterfly( "3", "visible");
  }
  //else if( currentTab == 4) {
  else if( FOUR == 4) if( currentTab == 4) {
    tNvDiv.innerHTML += link[1] + vertLine[1] + link[2] + vertLine[2] + link[3] + tab[4] + tabBottomBorder[4];
    butterfly( "4", "visible");
  }
  
  //
  // Register event handlers
  // 
    
  if( currentTab != 1) {
    document.getElementById( "tNv1").onmouseover= function() { butterfly( "1", "visible"); }
    document.getElementById( "tNv1").onmouseout=  function() { butterfly( "1", "hidden");  }
  }
  if( currentTab != 2) {
    document.getElementById( "tNv2").onmouseover= function() { butterfly( "2", "visible"); }
    document.getElementById( "tNv2").onmouseout=  function() { butterfly( "2", "hidden");  }
  }
  if( currentTab != 3) {
    document.getElementById( "tNv3").onmouseover= function() { butterfly( "3", "visible"); }
    document.getElementById( "tNv3").onmouseout=  function() { butterfly( "3", "hidden");  }
  }
  //if( currentTab != 4) {
  if( FOUR == 4) if( currentTab != 4) {
    document.getElementById( "tNv4").onmouseover= function() { butterfly( "4", "visible"); }
    document.getElementById( "tNv4").onmouseout=  function() { butterfly( "4", "hidden");  }
  }
  
} // end init_tNv()

/******************************
 *
 * SECOND-LEVEL NAVIGATION
 *
 *
 *****************************/
 
function glass( glassNumber, visibleOrHidden) {
  // called onmouseover and onmouseout
  document.getElementById( "sNvGlass" + glassNumber).style.visibility= visibleOrHidden;
}

function init_sNv( currentTab) {

  //
  // Create the "glasses" block of HTML
  //

  // Set the x-coordinate of each of the five glasses (absolute within <div id="sNv"> )
  var glassPos= new Array( 0, 38, 139, 251, 377, 492); // <-- element 0 is void; we start from 1
  
  // Build the HTML
  var glasses= "";
  for( var i=1; i<=5; i++) {
    glasses +=
        '<img id="sNvGlass'
      + i // id
      + '" style="position: absolute; left: '
      + glassPos[i] // pixels
      + 'px; top: 33px; visibility: hidden" src="/img/sNv_glass.gif" alt="Drink absinthe.">';
  }
  
  //
  // Vertical lines (dividers) between links
  //
  
  // Set the x-coordinate of each of the four lines
  var vertLinePos= new Array( 0, 87, 185, 297, 422); // <-- element 0 is void; we start from 1
  
  var vertLine= new Array();
  for( var i=1; i<=4; i++) {
    vertLine[i]=
        '<img style="position: absolute; left: '
      + vertLinePos[i]
      + 'px; top: 13px" src="/img/sNv_vl.gif" alt="">';
  }
  
  //
  // Links
  //
  
  // Set the x-coordinate of each of the five links, and their href and title attributes
  var linkPos=   new Array( 0, 8, 98, 196, 307, 433); // <-- element 0 is void; we start from 1
  var linkHref=  new Array( "", "/absinthe", "/green-fairy", "/mystical-absinthe", "/absinthe-comeback", "/absinthe-buyer-guide");
  var linkTitle= new Array( "", "Absinthe?", "Absinthe's Poetic Past", "Absinthe's Mystical Past", "Absinthe's Comeback", "Absinthe's Buyer's Guide");
  linkTitle= new Array( "", "", "", "", "", "");
  
  var link= new Array();
  for( var i=1; i<=5; i++) {
    link[i]=
        '<a id="sNv'
      + i // id
      + '" href="'
      + linkHref[i]
      + '" title="'
      + linkTitle[i]
      + '"><img style="position: absolute; left: '
      + linkPos[i] // pixels
      + 'px; top: 13px" src="/img/sNv_'
      + i // image name
      + '.gif" alt="'
      + linkTitle[i]
      + '"></a>';
  }
  
  //
  // Tabs
  //
  
  // Set the x-coordinate of each of the five tabs
  var tabPos= new Array( 0, 0, 86, 184, 296, 415); // <-- element 0 is void; we start from 1
  var tab= new Array();
  for( var i=1; i<=5; i++) {
    tab[i]=
        '<img style="position: absolute; left: '
      + tabPos[i]
      + 'px; top: 6px" src="/img/sNv_'
      + i // image name
      + 't.gif" alt="'
      + linkTitle[i]
      + '">';
  }
  
  //
  // Tab bottom borders
  //

  var tabBottomBorder= new Array();
  for( var i=1; i<=5; i++) {
    tabBottomBorder[i]=
        '<img style="position: absolute; left: 0px; top: 35px" src="/img/sNv_'
      + i // image name
      + 'tbb.gif" alt="">';
  }
  
  //
  // F L Y ...
  //
  
  var sNvDiv= document.getElementById( "sNv");
  
  //
  // Reposition <div id="sNv">
  //
  sNvDiv.style.left= "434px";
  sNvDiv.style.top=  "100px";
  
  sNvDiv.innerHTML= 
      '<img style="position: absolute; left: 0px; top: 59px" src="/img/thNv_bg1.gif" alt="">' // always
    + '<img id="flowerOrNot" style="position: absolute; left: -434px; top: 215px" src="/img/thNv_bg2.gif" alt="">' // always; we need the id!
    
    //+ '<a href="/" title="This page is printer-friendly..."><img style="position: absolute; left: 448px; top: 334px" src="/img/thNv_print.gif" alt="This page is printer-friendly..."></a>' // always
    //+ '<a href="/" title="Quickly email somebody a link to this page..."><img style="position: absolute; left: 448px; top: 358px" src="/img/thNv_email.gif" alt="Quickly email somebody a link to this page..."></a>' // always
    //+ '<a href="/" title="This whole website is an open forum about absinthe. Click to add an instant comment to this page..."><img style="position: absolute; left: 427px; top: 394px" src="/img/thNv_comment.gif" alt="This whole website is an open forum about absinthe. Click to add an instant comment to this page..."></a>' // always
    
    + link[1] + vertLine[1] + link[2] + vertLine[2] + link[3] + vertLine[3] + link[4] + vertLine[4] + link[5] // always
    + tab[currentTab] + tabBottomBorder[currentTab] // covers up the relevant link & vertical lines
    + glasses; // last (must be on top of everything!)
  
  //
  // Register event handlers
  // 
    
  if( currentTab != 1) {
    document.getElementById( "sNv1").onmouseover= function() { glass( "1", "visible"); }
    document.getElementById( "sNv1").onmouseout=  function() { glass( "1", "hidden");  }
  }
  if( currentTab != 2) {
    document.getElementById( "sNv2").onmouseover= function() { glass( "2", "visible"); }
    document.getElementById( "sNv2").onmouseout=  function() { glass( "2", "hidden");  }
  }
  if( currentTab != 3) {
    document.getElementById( "sNv3").onmouseover= function() { glass( "3", "visible"); }
    document.getElementById( "sNv3").onmouseout=  function() { glass( "3", "hidden");  }
  }
  if( currentTab != 4) {
    document.getElementById( "sNv4").onmouseover= function() { glass( "4", "visible"); }
    document.getElementById( "sNv4").onmouseout=  function() { glass( "4", "hidden");  }
  }
  if( currentTab != 5) {
    document.getElementById( "sNv5").onmouseover= function() { glass( "5", "visible"); }
    document.getElementById( "sNv5").onmouseout=  function() { glass( "5", "hidden");  }
  }
  
} // end init_sNv()

/******************************
 *
 * THIRD-LEVEL NAVIGATION
 *
 *
 *****************************/
 
function border( aTag, yesOrNo) {
  // called onmouseover and onmouseout

  var pTag= aTag.parentElement;
  
  if( pTag) {
  
    if( yesOrNo == 1) {
      //pTag.style.borderWidth= '1px';
      //pTag.style.borderColor= '#a5d264';
      pTag.childNodes[0].src= '/img/thNv_arr2.gif';
    }
    else {
      //pTag.style.borderWidth= '0px';
      //pTag.style.borderColor= '#fff';
      pTag.childNodes[0].src= '/img/thNv_arr.gif';
    }
  }
}
 
function init_thNv() {
  
  var divId= ["thNv", "thNvTwo"];
  
  var child= new Object;
    var childHTML;
    var whichArrow;
  
  for( var column=0; column<3; column++) { // There are two columns
  
    div= document.getElementById( divId[column]);
    
    if( div) {
  
      div.innerHTML= div.innerHTML.replace( /([\?\!])/g, "<i>$1</i>" );
    
      for( var i=0; i<div.childNodes.length; i++) {
  
        child= div.childNodes[i];

	    if( child.tagName == 'P' ) {
          if( child.className != "blank") { // Found non-empty <P>

            childHTML= child.innerHTML;
        
            if( childHTML.search( /<a/i) >= 0) {
              whichArrow= "";
              // From: What are the <a href="/"><b>effects</b> of absinthe?</a>
              // To:   <a href="/">What are the <b>effects</b> of absinthe?</a>
              childHTML= childHTML.replace( /(.*)(<a +href=".*")>(.*)<\/a>(.*)/i, "$2 onmouseover=\"border( this, 1)\" onmouseout=\"border( this, 0)\">$1$3$4</a>" );
            }
            else {
              whichArrow= "2";
              child.style.borderWidth=     '1px';
              child.style.borderStyle=     'dotted';
              child.style.borderColor=     '#a5d264';
              child.style.backgroundColor= '#e9f9d9';
              
              // Does the paragaraph have its title property set? I.e. as follows?
              // <p title="/absinthe/history">What is the <b>history</b> of absinthe?</p>
              // If so, it means we are NOT on a content-proper page, but somewhere
              // in its forum. The title is the uri of the underlying content-proper
              // page, so create the link:
              if( child.title) {
                if( child.title > "") {
                  child.style.cursor= 'pointer'; // ie5: hand?
                  child.onclick=      function() { document.location.href= this.title; }
                }
              }
            }
        
            childHTML= '<img src="/img/thNv_arr' + whichArrow + '.gif" style="position: relative; top: 1px"> '
                     + childHTML
                     + '<br><img src="/img/spacer.gif" style="width: 1px; height: 1px">';

            child.innerHTML= childHTML;
          }
        }
      }
	}
  }
}

/******************************
 *
 * FORUM
 *
 *
 *****************************/

function copyCommentsBlock() {

  function noFlower() {
    var thirdNaviFlowerBg= document.getElementById( "flowerOrNot"); // not.
    if( thirdNaviFlowerBg) {
      thirdNaviFlowerBg.src= '/img/thNv_bg2_noFlower.gif'; // no, no flower
    }
  }

  var copyFrom=  document.getElementById( "ftCl"); // footer comments (<P>)
  var copyTo=    document.getElementById( "rcC");  // right column comments (<DIV>)
  var commentsImg= '<img style="position: absolute; left: -8px; top: -17px" src="/img/rcC_hd.gif" alt="">'; // image must be transparent
  
  if( copyFrom && copyTo) { // This is an article page (because there is the "Post a message"
                            // block at the bottom of the page.
    copyTo.innerHTML=  commentsImg + copyFrom.innerHTML;
  }
  else {
    if( copyTo) { // Found <DIV id="rcC">

      var msgToJs= copyTo.innerHTML;
 
      if( msgToJs.indexOf( "P_") == 0) { // We should display a "P_ost a new message" link
                                         // (We are on a forum-read page.)

        var spacePos= msgToJs.indexOf( " ");
        copyTo.innerHTML=                // pageUri follows right after the "P_", then a space,
                                         // then a short description of the page:                 
        //commentsImg                    // e.g. "P_/absinthe/wormwood/forum/post the wormwood plant"
        
          '<a href="'   // Fix: the "pen" image should link as well
        + msgToJs.substring( 2, spacePos) + '"'
        + 'title="Have your say on the topic of ' + msgToJs.substring( spacePos+1) + '"'
        + '>'
        + commentsImg
        + '</a>'        // End fix.
        
        + '<a href="'
        + msgToJs.substring( 2, spacePos) + '"'
        + 'title="Have your say on the topic of ' + msgToJs.substring( spacePos+1) + '"'
        + '>Post a new<br>message</a><br><br><span>No registration is necessary '
        + '( <a href="/popup/forumPolicy.html" onclick="return( popUp(this.href))" title="This is an open forum. Click to learn more &gt;&gt;">Policy..</a> )</span>';
        
        noFlower(); // Oh, the flower don't fit there...
      }
      else {
        if( msgToJs.indexOf( "R_") == 0) { // We should display a "R_ead messages" link
                                           // (We are on a forum-post page.)
  
          var hashPos=  msgToJs.indexOf( "#");
          var spacePos= msgToJs.indexOf( " ");
          var howMany=  msgToJs.substring( hashPos+1, spacePos);

          if( howMany == "0") {
            copyTo.innerHTML=            // "R_/absinthe/wormwood/forum#0 the wormwood plant"
              commentsImg
            + '<b>Nobody</b> has yet<br>posted on this<br>topic. Be the first!';
          }
          else {
            if( howMany == "1") {
              copyTo.innerHTML=          // pageUri follows right after the "R_", then a #, then the number of comments
                                         // already posted by others, then a space, then a short description of the page:
                commentsImg              // e.g. "R_/absinthe/wormwood/forum#1 the wormwood plant"
              + '<b>1</b> person has<br>already posted<br>on this topic.<br><br>'
              + '<a href="'
              + msgToJs.substring( 2, hashPos) + '"'
              + 'title="Read what others say about ' + msgToJs.substring( spacePos+1) + '"'
              + '>Read message</a> (1)';
            }
            else {
              copyTo.innerHTML=          // e.g. "R_/absinthe/wormwood/forum_p02030101#24 the wormwood plant"
                commentsImg
              + '<b>' + howMany + '</b> people have<br>already posted<br>on this topic.<br><br>'
              + '<a href="'
              + msgToJs.substring( 2, hashPos) + '"'
              + 'title="Read what others say about ' + msgToJs.substring( spacePos+1) + '"'
              + '>Read messages</a> (' + howMany + ')';
            }
          }
          noFlower(); // Oh, the flower don't fit there...
        }
        else {
        // do nothing
        }
      }
    }
  }
}

function tidyEdPicks() {

  var edPicks= document.getElementById( "ftEPb");

  if( edPicks) {
    
    var source= edPicks.innerHTML.replace( /<a/ig, "<A" );
    var intro=  source.substring( 0, source.indexOf( '<A')).replace( /(Visitors to this site)/, "<b>$1</b>").replace( /\. /, ".<br>");
    
    var beginA, endA, nextBeginA, temp;
    var howManyPicks= 0;
    var result=  "";
    var finished= false;
    
    while( !finished)
    {
      howManyPicks++;
      
      beginA= source.indexOf( '<A');
      endA=   source.indexOf( '</') + 4;
      result += '&#149; ' + source.substring( beginA, endA);
  
      temp= source.substring( endA, source.length);
      nextBeginA= temp.indexOf( '<A');

      if( nextBeginA == -1) {
        nextBeginA= source.length;
        finished= true;
      }
      temp= temp.substring( 0, nextBeginA);
      result += temp.substring( 0, temp.lastIndexOf("at")-1) + ".<br>\n";

      source= source.substring( endA+nextBeginA, source.length);
    }
    
    edPicks.innerHTML=
      intro
    + ( howManyPicks > 1 ? "these contributions" : "this contribution" )
    + ':<br><img src="/img/spacer.gif" style="width: 1px; height: 8px"><br>'
    + result.substring( 0, result.length-5); // remove last ".<br>\n"

  } // end if( edPicks)
}

/******************************
 *
 * BUILD POP-UP LINKS (if any)
 *
 *
 *****************************/

function buildPopUpLinks() {
  
  var placeholderId= new Array( "",  "puSugLnk",                    "puForSml",                      "puEdPick"               );
  var anchorText=    new Array( "",  "Sugg"+"est a li"+""+"nk...",  "smileys or bold text<i>?</i>",  "How we pick these..."   );
  var pageName=      new Array( "",  "suggestLink",                 "forumSmileys",                  "edPicks"                );
  var linkStyle=     new Array( "",  "color: #999",                 "",                              "color: #999"            );
  
  var placeholder;

  for( var i=1; i<=3; i++) {
    placeholder= document.getElementById( placeholderId[i]);
    if( placeholder) {
      placeholder.innerHTML=
        '<a hr' + "" + 'ef="'
      + '/popup/'
      + pageName[i]
      + '.html" onclick="return( popUp(this.href))" style="'
      + linkStyle[i]
      + '">'
      + anchorText[i]
      + '</a>';
    }
  }
}

/******************************
 *
 * BUILD FRIENDS' ENTRIES
 *
 *
 *****************************/

function buildFriendsEntries() {
  
  if( document.getElementById( "puSugLnk")) { 
  
    var leftColumnDiv= document.getElementById( "lc");
  
    if( leftColumnDiv) {
      
      leftColumnDiv.innerHTML=
        leftColumnDiv.innerHTML
        + '<img src="/img/lcFR_hd.gif" alt="Recommended"><br>'
        + '<div align="center">'
        
        +   '<p><a href="http://www.theabsinthedrinkers.com/">'
        +   '<img src="/img/friends/absinthe-drinkers.gif" alt="The Absinthe Drinkers" style="margin-top: 5px; margin-bottom: 5px"><br>'
        +   '<b>The Absinthe Drinkers</b></a> is a Philadelphia band '
        +   'that combines poetry with original rock, jazz and funk - '
        +   'and the results are pretty amazing. '
        +   'If you fancy a bit of funked up Rimbaud, Baudelaire or Shakespeare, '
        +   'check out their site for upcoming shows or download '
        +   'sample tracks.</p>'
        
        +   '<p><a href="http://www.absinthenew.com/">'
        +   '<img src="/img/friends/absinthe-new.jpg" alt="Absinthe: New European Writing" style="margin-top: 5px; margin-bottom: 5px"><br>'
        +   '<b>Absinthe: New European Writing</b></a><br>'
        +   'is a biannual journal that publishes translations '
        +   'of contemporary European writing that -- like absinthe itself -- '
        +   'is not widely available in the United States. '
        +   'Published by a Detroit native Dwayne D. Hayes, '
        +   'the journal contains poetry, prose and essays. Recommended.</p>'
        
        +   '<p><a href="http://charleshamel.com/category/spiritual/">'
        +   '<img src="/img/friends/charleshamel.jpg" alt="Charles Hamel.com" style="margin-top: 5px; margin-bottom: 5px"><br>'
        +   '<b>Personal and Spiritual Growth<br>by Charles Hamel</b></a><br>'
        +   "Ever wondered why you are here, what's your purpose "
        +   'and how to make your stay more enjoyable and more meaningful? '
        +   "We like Charles' writings a lot - so pour a little absinthe, "
        +   'let the Fairy open your mind and then click over to explore!'
        
        +   '<p><img src="/img/bullet.gif" alt=""></p>'
        +   '<p><a href="/friends_etc">More recommended<br>websites...</a></p>'
        
        + '</div>';

    }
  }
}

/******************************
 *
 * CENTURY
 *
 *
 *****************************/

function century() {

  var element;
  
  var centuryLink= '<a hr' + 'ef="htt';
  centuryLink +=   'p://www.century' + WEBSITE.substring( 0, 8);
  centuryLink +=   WEBSITE.substring( 13);
  
  /*
  // Side image "Decadent News"
  var element= document.getElementById( "rcC");  // right column comments (<DIV>)
  if( element) {
    element.innerHTML +=
        '<br>&nbsp;<br>&nbsp;<br>'
      + centuryLink + '/?f=fv.nws">'
      + '<img style="position: relative; left: -10px" src="/img/century/news.gif" alt="">'
      + '</a>';
  }
  */
  
  // End-of-article image ("Deliciously decadent")
  element= document.body.innerHTML;
  var pos= element.indexOf( "ftCi"); // <p id="ftCi"> - and yes, we're in trouble if
  if( pos != -1) {                   // "ftCi" appears anywhere else on the page
    pos -= 7;
    document.body.innerHTML=
        element.substring( 0, pos)
      + '<p>' + centuryLink + '/?f=fv.del.img">'
      + '<img src="/img/century/delicious.jpg" alt=""></a></p>'
      // + '<p align="center" style="margin-top: -15px">' + centuryLink + '">' + 'Text here &raquo;</a></p>'
      + element.substring( pos);
  }
  

  /*
  var honeyLink= '<a hr' + 'ef="htt';
  honeyLink +=   'p://www.' + WEBSITE.substring( 0, 8) + 'honey';
  honeyLink +=   WEBSITE.substring( 13);

  // Side image "Honey
  element= document.getElementById( "rcC");  // right column comments (<DIV>)
  if( element) {
    element.innerHTML +=
        '<br>&nbsp;<br>&nbsp;<br>'
      + honeyLink + '/">'
      + '<img style="position: relative; left: -10px" src="/img/century/honey.gif" alt="">'
      + '</a>';
  }
  */

  var maktubLink= '<a hr' + 'ef="htt';
  maktubLink +=   'p://' + WEBSITE.substring( 0, 8);
  maktubLink +=   WEBSITE.substring( 13, 14) + 'in';

  /*
  // Side image "Maktub"
  element= document.getElementById( "rcC");  // right column comments (<DIV>)
  if( element) {
    element.innerHTML +=
        '<br>&nbsp;<br>&nbsp;<br>'
      + maktubLink + '/">'
      + '<img style="position: relative; left: -10px" src="/img/century/maktub.gif" alt="">'
      + '</a>';
  }
  */

  //
  // Century + Maktub
  // Jan 12, 2008
  //
  
  var centuryURL= centuryLink.substring( 20);
  var maktubURL=  maktubLink.substring( 16);
  
  element= document.getElementById( "rcC");  // right column comments (<DIV>)
  if( element) {
    element.style.backgroundColor= '#fff';  // <--important
    element.innerHTML +=
        '<br><br><br>'
      + centuryLink + '/?f=fv.btl.img">'
      + '<img style="position: relative; left: -10px" src="/img/century/century.jpg" alt="">'
      + '</a>'
      + '<br>'
      + centuryLink + '/?f=fv.btl.nam"><b STYLE="FONT-SIZE: 18PX; LINE-HEIGHT: 140%">Century 100</b></a>'
      + '<br>'
      + '<img style="MARGIN: 4PX 0PX 4PX 0PX" src="/img/century/5stars.gif" alt="">'
      + '<br>'
      + '<b>Stylish</b> tall bottle, <b>exquisite</b> flavour, <b>powerful</b> experience. This is the rare gem that' + "'s " + 'attracted something of a cult following amongst absinthe experts and enthusiasts alike. Available online at ' + centuryLink + '/?f=fv.btl.url">' + centuryURL + '</a><br>at $169 per bottle.'
      
      + '<br><br><br>'

      + maktubLink + '/?f=fv.btl.img">'
      + '<img style="position: relative; left: -10px" src="/img/century/maktub.jpg" alt="">'
      + '</a>'
      + '<br>'
      + maktubLink + '/?f=fv.btl.nam"><b STYLE="FONT-SIZE: 18PX; LINE-HEIGHT: 140%">Maktub Verte</b></a>'
      + '<br>'
      + '<img style="MARGIN: 4PX 0PX 4PX 0PX" src="/img/century/4stars.gif" alt="">'
      + '<br>'
      + '<b>Think the jazz age.</b> Maktub is an absinthe with a twist, made according to a 1920s recipe. And yes, it does taste (and feels) good. Also available in red &amp; black. Available from ' + maktubLink + '/?f=fv.btl.url">' + maktubURL + '</a> for '
      + '<span style="text-decoration: line-through">$145</span>&nbsp;<span style="font-size: 22px; color: #f00; position: relative; top: 4px">*</span>'
      + '<br><br>'
      + '<span style="font-size: 28px; color: #f00; position: relative; top: 8px; left: -2px">*</span><span style="font-size: 22px; color: #f00; position: relative; top: 2px; left: -2px"><i>)</i> $ave<i>!</i></span> Absinthe Fever'
      + "'s "
      + 'readers can <b>save $15</b> per bottle on the excellent Maktub. This month only and on your first order only, use <b>coupon</b> <b style="background-color: yellow; padding-left: 4px; padding-right: 4px">MK10288</b> to take advantage of the limited offer we'
      + "'ve "
      + 'negotiated. '
      + maktubLink + '/?f=fv.off.go">Go <img src="/img/thNv_arr2.gif" style="position: relative; top: 3px"></a>'
      +'<br><br>'
      +'<span style="font-size: 11px; color: #666">&mdash;Valid till July 31, 2010</span>'
      
      + '<br><br><br><br><br>&nbsp;';
  }

}

/******************************
 *
 * OPEN A POP-UP WINDOW
 *
 *
 *****************************/

function popUp( uri) {
  
  window.open( uri, 'AbsintheFeverPopUpWindow', 'left=15,top=15,width=350,height=550');
  return( false);
}

/******************************
 *
 * INIT ALL
 *
 *
 *****************************/

function absinthe ( tNvTab, sNvTab) { //init_thNv();

  if( document.getElementById) {
    if( tNvTab > -1) { init_tNv( tNvTab); }
    
    //---Uncomment the following 'if' line to enable Launch 2 Navi:
    //if( sNvTab > -1) { init_sNv( sNvTab); }
    
    //---Also delete the following 'if' block to enable Launch 2 Navi:
    if( true)
    {
      var sNvDiv= document.getElementById( "sNv");
      sNvDiv.style.left= "434px";
      sNvDiv.style.top=  "100px";
      sNvDiv.innerHTML= 
        '<img style="position: absolute; left: 0px; top: 59px" src="/img/thNv_bg1.gif" alt="">' // always
      + '<img id="flowerOrNot" style="position: absolute; left: -434px; top: 215px" src="/img/thNv_bg2.gif" alt="">' // always; we need the id!
      + '<img style="position: absolute; left: 0px; top: 6px" src="/img/sNv_0t.gif" alt="">'
      + '<img style="position: absolute; left: 0px; top: 35px" src="/img/sNv_0tbb.gif" alt="">'
      + '<img style="position: absolute; left: 489px; top: 33px" src="/img/sNv_glass.gif" alt="Drink absinthe.">';
    }
    
    init_thNv();
    tidyEdPicks();
    copyCommentsBlock();
    buildPopUpLinks();
    buildFriendsEntries();

    if( SHOW_CENTURY) {
      century();
    }
  }

} // end absinthe()

/******************************
 *
 * WE WANT TO HEAR FROM YOU...
 * (but no _s_p_a_m_...)
 *
 *****************************/

function emJS() {
  
  var a= 'ai';
  var b= ':';
  var c0= 60;
  var c= String.fromCharCode( c0+4);
  
  if( document.getElementById) {

    var J= document.getElementById( "emJ");
    if( J) {
      var name= J.innerHTML.toLowerCase();
      var x=   '<a hr' + "" + 'ef="m' + a + 'lto' + b;
      x +=     name + c + WEBSITE + '" title="' + name + c + WEBSITE + '">' + J.innerHTML + '</a>';
      J.innerHTML= x;
    }

    var S= document.getElementById( "emS");
    if( S) {
      var name= S.innerHTML.toLowerCase();
      var x=   '<a hr' + "" + 'ef="m' + a + 'lto' + b;
      x +=     name + c + WEBSITE + '" title="' + name + c + WEBSITE + '">' + S.innerHTML + '</a>';
      S.innerHTML= x;
    }
  }

} // end em()




