//******************************************************************************
//
//    Martin Labs Default JavaScript Tools v1.0
//
//    Created: June 25, 2002
//    Last Updated: Original
//    Author: Capt. W. L. "Bill" Martin Jr., ATP
//    JavaScript Code Copyright (c) 2002-2009 - Martin Labs
//
//    Change History:
//
//    20020625:
//    Capt. W. L. "Bill" Martin Jr., ATP
//    Original
//
//******************************************************************************


//    Global Variables
//    **************************************************************************

//    For Title Bar Animation:
   var TitleBarText = new Array();
      TitleBarText[00] = 'Welcome to Martin Labs';
      TitleBarText[01] = 'Home of Grand Format Television';
      TitleBarText[02] = 'Bringing Worlds Together';
      TitleBarText[03] = 'www.MartinLabs.com';
   var BeforeInsertedText = new Array(
         ' 0>-------------| ',
         ' 0->------------| ',
         ' 0-->-----------| ',
         ' 0--->----------| ',
         ' 0---->---------| ',
         ' 0----->--------| ',
         ' 0------>-------| ',
         ' 0------->------| ',
         ' 0-------->-----| ',
         ' 0--------->----| ',
         ' 0---------->---| ',
         ' 0----------->--| ',
         ' 0------------>-| ',
         ' 0------------->| ');
   var RepetitionsPerMessage = 4;
   var RepetitionSpeed = 50;
   var RepetitionsPerMessageCounter = 0;
   var MessageCounter = 0;
   var SequenceNumber = 0;
   var AnimationTimer = null;
   var InsertedText = '';
   var AfterInsertedText = '';

//    For Hide Right Click Menu:
   var message = '';

//    For Status:
   var MLStatusSpace = '       ';


//    For MLMail:
   var MLThing = '';

//    For FeaturesWindow:
   var MLFeaturesPopUp = null;


var MLLinkToOpen = null;

//    Pop Up Window Generator
//    **************************************************************************

function MLPopUpOpen(MLLinkToOpen)
{
window.open('children/features/'+MLLinkToOpen,'MLPopUp','height=400,width=300,toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0');
}

//    Title Bar Animation Start
//    **************************************************************************

function MLTitleBarAnimator()
{
//    Commented Out Because of AOL Browser**************************************
/*   if (RepetitionsPerMessage < 1)    // Error Trap For Too Few RepetitionsPerMessage
      {
      RepetitionsPerMessage = 1;
      }
   MLTitleBarTextChange();
*/
}
//    Title Bar Text Change
//    **************************************************************************

function MLTitleBarTextChange()
{
   InsertedText = TitleBarText[MessageCounter];
   MLAnimator();
}


//    Title Bar Animator
//    **************************************************************************

function MLAnimator()
{
   if (SequenceNumber > (BeforeInsertedText.length - 1))
      {
      SequenceNumber = 0;
      }
   document.title = BeforeInsertedText[SequenceNumber] + InsertedText + AfterInsertedText; 
   SequenceNumber++;
   if (RepetitionsPerMessageCounter < ((BeforeInsertedText.length) * RepetitionsPerMessage))
      {
      AnimationTimer = setTimeout('MLAnimator()', RepetitionSpeed);
      RepetitionsPerMessageCounter++;
      }
      else
      {
      AnimationTimer = null;
      RepetitionsPerMessageCounter = 0;
      SequenceNumber = 0;
      MessageCounter++;
      if(MessageCounter > (TitleBarText.length - 1))
         {
         MessageCounter = 0;
         }
      MLTitleBarTextChange();
      }
}


//    Hide Right Click Menu Start
//    **************************************************************************

function MLHideMenu()
{
   if (document.layers)
      {
      document.captureEvents(Event.MOUSEDOWN);
      document.onmousedown = contextNetScape;
      }
   else
      {
      document.onmouseup = contextNetScape;
      document.oncontextmenu = contextInternetExplorer;
      }
   document.oncontextmenu = new Function("return false")
}

//    Hide Right Click Menu (Netscape)
//    **************************************************************************

function contextNetScape(mousebutton)
{
   if (document.layers || (document.getElementById && !document.all))
      {
      if (mousebutton.which == 2 || mousebutton.which==3)
         {
         (message);
         return false;
         }
      }
}


//    Hide Right Click Menu (Internet Explorer)
//    **************************************************************************

function contextInternetExplorer()
{
   if (document.all)
      {
      (message);
      return false;
      }
}


//    Mouse Over Text Effect On
//    **************************************************************************

function MLMouseOver(MLThis)
{
//   var MLIETest = navigator.appVersion.indexOf("MSIE");
//   MLIEVersion = (MLIETest > 0) && (parseInt(navigator.appVersion.substring(MLIETest + 5, MLIETest + 6)) >= 4);
//   if (MLIEVersion)
//      {
      MLThis.initstyle = MLThis.style.cssText;
      MLThis.style.cssText = MLThis.MLMouseOverStyle;
//      }
}


//    Mouse Over Text Effect Off
//    **************************************************************************

function MLMouseOut(MLThis)
{
//   var MLIETest = navigator.appVersion.indexOf("MSIE");
//   MLIEVersion = (MLIETest > 0) && (parseInt(navigator.appVersion.substring(MLIETest + 5, MLIETest + 6)) >= 4);
//   if (MLIEVersion)
//   {
   MLThis.style.cssText = MLThis.initstyle;
//   }
}


//    Mail Script
//    **************************************************************************

function MLMail(MailNumber)
{
   MLThing = '<a href="mailto:' + 'Info' + '@MartinLabs.com"';
   MLThing = MLThing + 'style="text-decoration: none ! important;"';
   MLThing = MLThing + 'MLMouseOverStyle="font-size: 12px ! important;"';
   MLThing = MLThing + 'onmouseover="MLMouseOver(this);self.status = \'       eMail Martin Labs for General Information\'; return true;"';
   MLThing = MLThing + 'onmouseout="MLMouseOut(this);"'
   MLThing = MLThing + '>DoDo@MartinLabs.com</a>'
   document.write(MLThing);
}


//    Features Pop Up
//    **************************************************************************

function MLDisplayFeatures()
{
   if ( (MLFeaturesPopUp == null ) || MLFeaturesPopUp.closed )
      {
      MLFeaturesPopUp = window.open((MLMenuDepthLink + "children/features/index.htm"),"FeaturesPopUp");
      if (!MLFeaturesPopUp.opener)
         {
         MLFeaturesPopUp.opener = self;
         }
      }
   else
      {
      MLFeaturesPopUp.focus();
      }
}


//    End
//******************************************************************************
