
SITE= "absinthe.msjekyll.com";
// self.focus(); // used for centuryPPU

function readCookieValue( cookieName) {

  var allCookies= document.cookie;
  var pos= allCookies.indexOf( cookieName + "=");
  if( pos == -1) return( false); // no such cookie
  // else:
  var start= pos + cookieName.length + 1;       // length of "name="
  var end=   allCookies.indexOf( ";", start);   // until first ";"
  if( end == -1) end= allCookies.length;        // or until the end
  return( allCookies.substring( start, end));   // here's the cookie value
}

function absinthe( thujone ) {

  //
  // Register event handlers
  //
  
  // Tabs

  if( document.getElementById( "tOneH"))
  {
    document.getElementById( "tOneH").onmouseover= function() { document.getElementById( "tOneI").src= "/img/t1y.gif"; }
    document.getElementById( "tOneH").onmouseout=  function() { document.getElementById( "tOneI").src= "/img/t1.gif";  }
  }
  if( document.getElementById( "tTwoH"))
  {
    document.getElementById( "tTwoH").onmouseover= function() { document.getElementById( "tTwoI").src= "/img/t2y.gif"; }
    document.getElementById( "tTwoH").onmouseout=  function() { document.getElementById( "tTwoI").src= "/img/t2.gif";  }
  }
  if( document.getElementById( "tThreeH"))
  {
    document.getElementById( "tThreeH").onmouseover= function() { document.getElementById( "tThreeI").src= "/img/t3y.gif"; }
    document.getElementById( "tThreeH").onmouseout=  function() { document.getElementById( "tThreeI").src= "/img/t3.gif";  }
  }

  var lnk= '<a hr' + 'ef="ht';
  lnk +=   'tp://ww' + 'w.cen';
  var fk=  "";
  lnk +=   'tury' + SITE.substring( 0, 8);
  lnk +=   SITE.substring( 17);

  artshow ( "init");

  /*
  
  //
  // PPU
  //
  
  var ppuShownAlready= readCookieValue( "centuryPPU");
  
  if( ppuShownAlready != "1") // not shown yet
  {
    document.cookie= "centuryPPU=1; path=/";

    centuryLink= lnk.substring( 16);
    var allLinks= document.links;
  
    if( allLinks)
    {
      for( var i=0; i < allLinks.length; i++)
      {
        if( allLinks[i].href.indexOf( centuryLink) == -1)
        {
          allLinks[i].onclick=

          function() {
        
            var left=   window.screenX     != undefined  ?  window.screenX     : window.screenLeft;
            var top=    window.screenY     != undefined  ?  window.screenY     : window.screenTop           -  50;
            var width=  window.innerWidth  != undefined  ?  window.innerWidth  : document.body.clientWidth  -  50;
            var height= window.innerHeight != undefined  ?  window.innerHeight : document.body.clientHeight - 100;

            var centuryOpened= window.open(
              'htt' + 'p://' + centuryLink + '/?f=mj.ppu',
              'AbsintheFeverCenturyWindow',
              'left=' + left + ',top=' + top + ',width=' + width + ',height=' + height +
              ',menubar=yes,toolbar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes'
             );
            if( centuryOpened)
            {
              centuryOpened.blur();
              window.focus();
            }
          }
        }
      }
    }
  }
  return( false); // <--this is IMPORTANT! Explorer can crash otherwise!
  
  //
  // End PPU
  //
  
  */
  
  /*

  var element;
  var elementHtml;
  var pos;

  // "Dec/news"
  document.write(
        lnk + '/?f=mj.nws">'
      + '<img style="position: absolute; left: 814px; top: 12px" src="/img/decadence.gif">'
      + '</a>'
  );

  // "Deli/dec"
  element= document.getElementById( "ft");
  if( element) {
    elementHtml= element.innerHTML;
    pos= elementHtml.indexOf( "good sitez:"); // <p>Other good sitez:<br>
    if( pos != -1) {
      pos += 15;
      element.innerHTML=
          elementHtml.substring( 0, pos)
        + lnk + '/?f=mj.del">'
        + '<img src="/img/fairy.gif" style="margin-bottom: 4px"></a><br>'
        + elementHtml.substring( pos);
    }
  }
  
  */
}

function fairy () {

  // <form action="/cgi-bin/forum/newtopic.cgi" method="POST" onsubmit="return fairy ();">
  // <form action="/cgi-bin/forum/post.cgi" method="POST" onsubmit="return fairy ();">

  var noSpamFormField= document.getElementById( "nospam");
  if( noSpamFormField) {
    noSpamFormField.value= "no" + "way"; // sub read_input() in forum.pm checks for this value
  }
  
  var yesOrNo= confirm( 'Post this message? Click OK to confirm.');
  return( yesOrNo);
}

function thujone () {

  var maktub= '<a hr' + 'ef="ht';
  maktub +=   'tp://' + SITE.substring( 0, 8);
  maktub +=   '.in';
  
  //alert(document.URL);

  var ftDiv= document.getElementById( "ft");
  if( ftDiv                                                    &&
      (document.URL.indexOf( "century-absinthe.shtml") == -1)  &&  // exceptions
      (document.URL.indexOf( "20021.shtml") == -1)             &&
      (document.URL.indexOf( "buy-absinthe.shtml") == -1)
    )
  {
    ftDiv.innerHTML=
        '<img src="/img/ft.jpg" alt="">' + "\n"
   // + '<img src="/img/butterfly.gif" alt="Butterfly" id="butterfly">' + "\n"

      + '<p style="line-height: 120%"><span style="font-size: 18px">MsJekYll recommends Maktub Absinthe</span><br>'
      +   maktub + '/?f=mj.ang.img">'
      +   '<img src="/img/maktub.gif" style="margin: 8px"></'
      +   'a><br>'
      +   'This funky, jazz-age absinthe is available exclusively at ' + maktub
      +   '/?f=mj.ang.url" style="font-weight: normal">' + 'absinth' + 'e.in' + '</'
      +   'a>. Gives a very good buzz<br>'
      +   'and costs just $85 a bottle, which is a bargain for this kind of product. My advice:<br>'
      +   'add a bottle or two to your bar right now.</p>' + "\n"

      + '<p>&nbsp;<br>_______________________________________________<br>'
      +   '<strong>Copyright &copy; 1997-2009 MsJekYll</strong><br>'
      +   'Dancing with the Green Fairy.<br>'
      +   'Since 1997.</p>' + "\n"
      + '<p style="margin-bottom: -32px">&nbsp;</p>';
  }
}

// ----------------------------------------- //
// MsJekyll'z Absinthe Art Show begins here  //
// ----------------------------------------- //

// Global; executes as soon as wormwood.js loads

if( typeof( screen) == "object")
  var fixedOrNot= ( screen.height < 1024 ? "" : "  body>#artshow { position: fixed; } ");

var ARTSHOW= new Object();

ARTSHOW.begin= 
      '<style> '
    + '  #artshow * { margin: 0px; padding: 0px; } '
    + '  #artshow   { position: absolute; left: 825px; top: 12px; } ' // <-- "position: absolute" first (for IE6 or lower)
    +    fixedOrNot  // <-- IE6 and lower will not understand "body>#artshow" - modern browsers will and so will use "position: fixed"
    + '  #artshow div { position: absolute; font-family: Arial, Helvetica, sans-serif; } '
    + '  #artshow div a { text-decoration: underline; font-weight: normal; } '
    + '  #artshow #artshowNavi { left:  0px; top: 512px; width: 408px; background-color: transparent; text-align: center; color: #333; font-size: 11px; } '
    + '  #artshow #artshowNavi b       { color: #f00; font-weight: bold; } '
    + '  #artshow #artshowNavi a       { color: #00f; } '
    + '  #artshow #artshowNavi a:hover { text-decoration: none; } '
    + '  #artshow #artshowNavi span    { color: #999; } '
    + '  #artshow #artshowImg    { position: absolute; left: 10px; top: 10px } '
    + '  #artshow #artshowDesc   { left: 32px; top: 551px; width: 366px; color: #fff; font-size: 13px; } '
    + '  #artshow #artshowDesc strong { font-size: 16px; } '
    + '  #artshow #artshowDesc a { color: #fff; } '
    + '  #century { z-index: 99; } ' // over the artshow div
    + '</style> '
    + '<div id="artshow">';
    
ARTSHOW.piece= new Array();

ARTSHOW.piece[1]= 
      '  <a href="http://www.centuryabsinthe.com/"><img src="/img/artshow/bg.gif" style="position: absolute; left: 0px; top: 0px"><img id="artshowImg" src="/img/artshow/1.jpg"></a>'
    + '  <div id="artshowDesc"><strong>Century Absinthe in the style<br>of Alphonse Mucha</strong><br><br>'
    + '    <b>Artist:</b> R.L. Macaulay (2009) &#149; <a href="http://www.rlmacaulay.com/home/galleryp.htm">RLMacaulay.com</a><br>'
    + '    <b>Technique:</b> Watercolor on Arches watercolor paper (10&quot;x7&quot;)<br><br>'
    + "    <b>Notes:</b> This charming piece by Rebecca Macaulay is executed in the distinctive style of Alphonse Mucha, who was, arguably, one of the greatest of Art Nouveau painters and decorative artists. To see more of Rebecca's art, <a href=\"http://www.rlmacaulay.com/home/galleryp.htm\">visit her website</a>. To experience Century, the absinthe that inspired this piece, <a href=\"http://www.centuryabsinthe.com/\">click here</a>.";

ARTSHOW.piece[2]= 
      '  <a href="http://absinthe.in/"><img src="/img/artshow/bg.gif" style="position: absolute; left: 0px; top: 0px"><img src="/img/artshow/2.jpg" style="position: absolute; left: 10px; top: 10px"></a>'
    + '  <div id="artshowDesc"><strong>Maktub Absinthe: A brand identity<br>by Natascha Lavrova</strong><br><br>'
    + '    <b>Artist:</b> Natascha Lavrova (2006) &#149; <a href="mai' + '' + 'lto:nata' + 'scha@lavrova.org">Contact</a><br>'
    + "    <b>Technique:</b> Canon 5D Mark II, Photoshop, &quot;iNked God&quot; and &quot;Helena's Hand&quot; fonts.<br><br>"
    + "    <b>Notes:</b> Straight from the <span style=\"text-decoration: line-through\">horse's</span> artist's mouth: &quot;I was pleased to have been asked to work with Maktub prior to their launch in 2006. The company and I did bounce ideas back and forth like a ping-pong ball for a bit (aggressively at times&mdash;but that's the nature of the game <b>:-)</b> but we did finally agree on a light, clean look expressing both the purity and the funkiness of <a href=\"http://absinthe.in/\">Maktub</a>.&quot;";

ARTSHOW.piece[3]= 
      "  <a href=\"http://www.absinthefever.com/absinthe/history\"><img src=\"/img/artshow/bg.gif\" style=\"position: absolute; left: 0px; top: 0px\"><img src=\"/img/artshow/3.jpg\" style=\"position: absolute; left: 10px; top: 10px\"></a>"
    + '  <div id="artshowDesc"><strong>Dornier-Tuller Absinthe:<br>A vintage advertising poster</strong><br><br>'
    + '    <b>Artist:</b> Unknown (circa 1910)<br>'
    + '    <b>Technique:</b> Chromolithography<br><br>'
    + "    <b>Notes:</b> Pernod Fils, Edouard and Berger weren't the only distilleries making great absinthe <a href=\"http://www.absinthefever.com/absinthe/history\">before the ban</a>. This period poster promoted Dornier-Tuller, one of the smaller artisanal distillers whose absinthe won many awards at the time. A surviving bottle (discovered in 2007) was judged &quot;velvety, smooth and seductively fruity&quot; by those lucky enough to sample it.";

ARTSHOW.piece[4]= 
      '  <a href="http://www.centuryabsinthe.com/"><img src="/img/artshow/bg.gif" style="position: absolute; left: 0px; top: 0px"><img src="/img/artshow/4.jpg" style="position: absolute; left: 10px; top: 10px"></a>'
    + '  <div id="artshowDesc"><strong>The Absinthe Ritual</strong><br><br>'
    + '    <b>Artist:</b> Lori Lynn Stokoe (2009) &#149; <a href="http://www.tastewiththeeyes.com/">Website</a><br>'
    + '    <b>Technique:</b> Photography<br><br>'
    + "    <b>Notes:</b> Absinthe is best enjoyed in a sort-of <a href=\"http://www.absinthefever.com/absinthe/ritual\">ritualistic</a> way, which usually involves dripping ice-cold water over a cube of sugar resting on a perforated absinthe spoon. Lori Lynn Stokoe, an LA-based cook and food writer, took this shot to document her adventures with the <a href=\"http://www.centuryabsinthe.com/\">Decadent Goddess</a>. If you are a foodie like me, you will want to click over to her website, <a href=\"http://www.tastewiththeeyes.com/\">Taste with the Eyes</a>. Fantastic recipes and photography.";

ARTSHOW.piece[5]= 
      '  <a href="http://buyabsinthe.net/glass"><img src="/img/artshow/bg.gif" style="position: absolute; left: 0px; top: 0px"><img src="/img/artshow/5.jpg" style="position: absolute; left: 10px; top: 10px"></a>'
    + '  <div id="artshowDesc"><strong>Antique Uranium Absinthe Glassware</strong><br><br>'
    + '    <b>Artist:</b> Molly Maloof (2009) &#149; <a href="http://www.facebook.com/people/Molly-Maloof/1906334">Contact</a><br>'
    + '    <b>Technique:</b> Blacklight (UV) photography<br><br>'
    + "    <b>Notes:</b> Glassware enriched with uranium salts glows bright green under UV light due to the outer electrons exiting the uranium atoms (yes, uranium glassware does give a positive reading on the Geiger counter). This type of glassware was very popular during absinthe's heyday; today, it has pride of place in any serious absinthe collector's cabinet. Check out the BuyAbsinthe.Net blog for a more comprehensive <a href=\"http://buyabsinthe.net/glass\">guide to absinthe glassware</a>.";

ARTSHOW.currentPiece= readCookieValue( "artshow_currentPiece");
if( !ARTSHOW.currentPiece) { ARTSHOW.currentPiece= 0; }

ARTSHOW.lastPiece= ARTSHOW.piece.length - 1;

ARTSHOW.end= '</div>';

// ---------------------------------------
function artshow_navi () {
// ---------------------------------------

  var navi=
      '    <br><br><br>'
    + '    &raquo; <a href="/forum/20001.shtml">Showcase your original art</a><br><span style="color: #000">&raquo;</span> on MsJekyll.com'
    + '  </div>'
    + "  <div id=\"artshowNavi\"><b>&laquo;</b> <a href=\"javascript:artshow( 'prev')\">Prev</a> &nbsp;&nbsp;<span>|</span>&nbsp;&nbsp; "
    + ARTSHOW.currentPiece + ' of ' + ARTSHOW.lastPiece
    + "&nbsp;&nbsp;<span>|</span>&nbsp;&nbsp; <a href=\"javascript:artshow( 'next')\">Next</a> <b>&raquo;</b></div>";

  return( navi);
}

// ---------------------------------------
function artshow ( doWhat) {
// ---------------------------------------

  // Called from function absinthe() (see above), which itself is called right before </body></html>

  if( doWhat == "init")
  {
    if( ARTSHOW.currentPiece == ARTSHOW.lastPiece) { ARTSHOW.currentPiece= 1; }
    else                                           { ARTSHOW.currentPiece++;  }
    
    // Exceptions
    if( (document.URL.indexOf( "century-absinthe.shtml") > -1) || (document.URL.indexOf( "20021.shtml") > -1))
      ARTSHOW.currentPiece= 4; // Lori Lynn's photo

    document.write( ARTSHOW.begin + ARTSHOW.piece[ARTSHOW.currentPiece] + artshow_navi() + ARTSHOW.end);
    document.cookie= "artshow_currentPiece=" + ARTSHOW.currentPiece + "; path=/";
    
    // Preload images
    document.write( "\n\n");
    for( var i=1; i <= ARTSHOW.lastPiece; i++)
      document.write( '<img style="width: 1px; height: 1px" src="/img/artshow/' + i + '.jpg">');
  }
  else
  {
    if( doWhat == "next")
    {
      if( ARTSHOW.currentPiece == ARTSHOW.lastPiece) { ARTSHOW.currentPiece= 1; }
      else                                           { ARTSHOW.currentPiece++;  }
    }
    else if( doWhat == "prev")
    {
      if( ARTSHOW.currentPiece == 1) { ARTSHOW.currentPiece= ARTSHOW.lastPiece; }
      else                           { ARTSHOW.currentPiece--;  }
    }
    else 
    {
      var requestedPieceNo= parseInt( doWhat);
      if( (requestedPieceNo >= 0) && (requestedPieceNo <= ARTSHOW.lastPiece))
      {
        ARTSHOW.currentPiece= requestedPieceNo;
      }
    }

    document.getElementById( "artshow").innerHTML= ARTSHOW.piece[ARTSHOW.currentPiece] + artshow_navi();
    document.cookie= "artshow_currentPiece=" + ARTSHOW.currentPiece + "; path=/";
  }
}

