﻿// JAVASCRIPT FOR NEUROTICPOETS.COM
// Copyright Brenda C. Mondragon, All Rights Reserved
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
defaultStatus = "Neurotic Poets Web Site"

////////////////////////////////////////////////////////////////////////////
//browser detecting (NS6 includes Mozilla)                       NS6 NS4 IE(5)
var d_n4  = (document.layers)                              ? 1:0  //  0   1   0
var d_n   = (document.getElementById && !(document.all))   ? 1:0  //  1   0   0
var d_ie  = (document.all)                                 ? 1:0  //  0   0   1
// adjustments for khtml browsers
var is_khtml = (navigator.vendor == 'KDE')?true:false;
var is_konq = (navigator.vendor == 'KDE')||(document.childNodes)&&(!document.all)&&(!navigator.taintEnabled)?true:false;
var is_safari = (document.childNodes)&&(!document.all)&&(!navigator.taintEnabled)&&(!navigator.accentColorName)?true:false;
var is_omniweb45plus = (document.childNodes)&&(!document.all)&&(!navigator.taintEnabled)&&(navigator.accentColorName)?true:false;
if (is_khtml || is_konq || is_safari || is_omniweb45plus) { d_n4 = 1; d_ie = 0; }
////////////////////////////////////////////////////////////////////////////
//if ((d_ie == 1) && (navigator.userAgent.toLowerCase().indexOf('konqueror') > 0)) { d_n4 = 1; d_ie = 0; }
//konqueror (at least) acts like nn4 in that the links do not slide with the text
//alert("d_n4 - "+d_n4+"\nd_n - "+d_n+"\nd_ie - "+d_ie);
////////////////////////////////////////////////////////////////////////////
//if (d_n4) {document.write("<style type=\"text/css\">#slide { position: relative; top: 0px; left: 0px; visibility: visible; }</style>");}
//can't use above line for N4 because the links "stay" in the same place while the text moves
if (d_n4) {document.write("<style type=\"text/css\">#slide { position: absolute; top: 175px; left: 25px; visibility: visible; }</style>");}
if (d_n4) {document.write("<style type=\"text/css\">#slide_start { position: relative; visibility: visible; }</style>");}
if (d_n4) {document.write("<style type=\"text/css\">#slide_stop { position: relative; visibility: visible; }</style>");}
if (d_n4) {document.write("<style type=\"text/css\">#slide_end { position: relative; visibility: visible; }</style>");}
if (d_ie || d_n) {document.write("<style type=\"text/css\">#slide { position: relative; visibility: visible; }</style>");}

////////////////////////////////////////////////////////////////////////////
//attempt to scroll to original link when returning from a resource page
function resRefJump()
{
  if (document.referrer != '')
  {
    //alert(document.referrer);
    var ref = document.referrer.toLowerCase();
    var loc = document.location.href.toLowerCase();
    if (
      ((ref.indexOf('neuroticpoets') > -1) || (ref.indexOf('127.0.0.1') > -1) || (ref.indexOf('192.168.') > -1))
      &&
      ((loc.indexOf('/byron/') > -1) || (loc.indexOf('/shelley/') > -1) || (loc.indexOf('/poe/') > -1) || (loc.indexOf('/rossetti/') > -1) || (loc.indexOf('/dickinson/') > -1) || (loc.indexOf('/wilde/') > -1) || (loc.indexOf('/thomas/') > -1) || (loc.indexOf('/plath/') > -1))
      )
    {
      var refParts = new Array();
      refParts = ref.split('/');
      var refDir = refParts[refParts.length-2];
      if ((/^\d+/).test(refDir)) { refDir = 'id' + refDir; }//because id attribute cannot begin with digits, have to add a string to the beginning, "id" was chosen
      //alert('-'+refDir+'-');
      //alert(document.getElementById(refDir));
      if (refDir != '' && document.getElementById(refDir))
      {
        document.location = document.location + "#" + refDir;
      }
    }
  }
}
AttachEvent(window,'load',resRefJump,false);

AttachEvent(window,'load',preload_images('/images/neurotic_poets_home.jpg'),false);
