////////////////////////////////////////////////////////////////////////////////////////////
// This JavaScript Library has been hacked to be used on my website.
// If you really have to use it, go ahead and use it. Or any functions in here.
// You should, however, include a line crediting my work to "Revence 27".
// It could take on the form:
//
// Script By Revence 27
// http://revence27.faithweb.com
//
// Do that as freeely as I have given you this script. It's the only condition.
// Enjoy. :o)
// Mozilla Firefox 1.0, Microsoft Internet Explorer 6.0, Opera Browser 7.0, Netscpae 6.0
// JavaScript 1.5, W3C DOM Level 1
/////////////////////////////////////////////////////////////////////////////////////////////

// Browser detection ...
var Firefox  = /Firefox/gi.test(navigator.userAgent);
var Netscape = /Netscape/gi.test(navigator.appName) && !Firefox;
var Opera    = window.opera;
var IE       = document.all && !Opera;
var W3C      = document.getElementById && document.getElementsByTagName;
var Gecko    = /Gecko/gi.test(navigator.userAgent);
var Unknown  = !Firefox && !Netscape && !Opera && !IE && !Gecko;

// The work begins ...
var dt = new Date(), yr;
yr = dt.getYear();
if(yr < 1900)  // Firefox's getYear() returns years after 1900.
yr += 1900;

// All the tables in my pages are direct results of Freeservers.com. So ...
function kickTables()
{
 var tbs = document.getElementsByTagName('table');
 for(var notI = 0; notI < tbs.length; ++notI)
 {
  tbs[notI].style.display = "none";
 }
}

function makeLiveTime()
{
 var dat = new Date();
 var lv = document.getElementById('livetime');
 var hr = dat.getHours(), mi = dat.getMinutes(), sec = dat.getSeconds(), pm = false;
 if(hr > 12)
 {
  pm = true;
  hr = hr - 12;
 }
 lv.innerHTML = (hr < 10 ? "0" : "") + hr + ":" + (mi < 10 ? "0" : "") + mi + ":" + (sec < 10 ? "0" : "") + sec + (pm ? " PM" : " AM");
}

function makeNeatDateString()
{
  return(dt.toLocaleDateString() + ". <span id=\"livetime\">" + dt.toLocaleTimeString() + "</span>");
}

function kubeTheDate()
{
 try
 {
  var dt = document.getElementById('dt');
  dt.innerHTML = makeNeatDateString();
 }
 catch(error)
 {
  //alert(error.message);
 }
}

function hideAllIframesThatDontBelongToMe()
{
 var ifs = document.getElementsByTagName('iframe');
 for(var notI = 0; notI < ifs.length; ++notI)
 {
  if(ifs[notI].id == 'myown')
  continue;
  
  // Thus far, and the IFRAME has been put by FreeServers. That's "Thus", not "a typo.

  ifs[notI].style.display = "none";
 }
}

function getASafeRandom(limit)
{
 var val = Math.round(Math.random() * limit);
 return(val);
}

function giveThemARandomQuipHoney()
{
 try
 {
  var quipArray = new Array("The folly of man is the wisdom of the gods", "Open, Sesame!", "Here comes the boy from the murky Entebbe paths ...",
                            "Making war, I have found, is easier than making peace.", "Never be passionate. About anything. Except programming.",
                            "For the mind of man knoweth not. But his heart doth.", "Random quips to keep you refreshing the page.",
                            'print "Content-Type = \\"crap\\plain-crap\\"\\n\\n";', "E-Baz signed my Guestbook!", "VB/VBA/VBScript, XHTML, JavaScript, Java, C/C++, Perl, ASP, T-SQL, Python, ...");
  var randomNumber = getASafeRandom((quipArray.length - 1));
  var basket = document.getElementById('rand');
  basket.innerHTML = quipArray[randomNumber];
 }
 catch(error)
 {
  //alert(error.message);
 }
}

function makeLinksHot()
{
 try
 {
  var ls            = document.links;
  var pointer       = document.createElement('div');
  pointer.innerHTML = "&laquo;&laquo;";
  pointer.id        = "pointer";
  document.getElementsByTagName('body')[0].appendChild(pointer);
  for(var notI = 0; notI < ls.length; ++notI)
  {
   if(ls[notI].className != 'm')
   continue;

   // We get this far, we're dealing with a menu link.

   var lk = ls[notI];
   lk.onmousemove = function(ev)
                    {
                     document.getElementById('pointer').style.top = (IE ? event.y : ev.pageY);
                    }
  }
 }
 catch(error)
 {
  //alert(error.message);
 }
}

function collapseMenu(huh)
{
 if(huh)
 {
  document.getElementById('menu').style.display = "none";
  var c       = document.getElementById('but1');
  c.innerHTML = "Restore Menu";
  c.href      = "javascript:collapseMenu(false)";
  c.title     = "Click Here To Restore The Menu";
 }
 else
 {
  document.getElementById('menu').style.display = "inline";
  var c       = document.getElementById('but1');
  c.innerHTML = "Collapse Menu";
  c.href      = "javascript:collapseMenu(true)";
  c.title     = "Click Here To Callapse The Menu"
 }
}

function sendMeMail(subject)
{
 var add   = "mailto:";
 add      += "genius";           // This is ...
 add      += "@";               // ... to elude some ...
 add      += "praize.com";      // ... very clever spammers.
 add      += "?subject=" + subject;
 document.location = add;
}

function onLoadProcedure()
{
 var lkg = document.getElementById('lkg');
 lkg.onmousemove = function(ev)
                   {
                    lkg.style.borderStyle = "inset";
                    document.getElementById('pointer').style.top = ((IE ? event.y : ev.pageY) - 10);
                   }
 lkg.onmouseout = function(ev)
                  {
                   lkg.style.borderStyle = "outset";
                  }
 makeLinksHot();
 giveThemARandomQuipHoney();
 kubeTheDate();
 kickTables();
 window.setInterval('makeLiveTime()', 1000);
 hideAllIframesThatDontBelongToMe(); // Removes all FreeServers banners that are in Iframes.
 try{void(sideFrameOff());}catch(error){/*This error is handled, in case FreeServrs didn't put that sick ad of dancing fish.*/}
}

window.onload = onLoadProcedure;
