//------------------------------------------------------------------------------
// Project:       Structural Design of Stainless Steel
// Copyright:     © 2003-2004, The Steel Construction Institute
// File version:  1.0.025h
// File name:     _Scripts/Hover.js
// Description:   Help hendling scripts
// Developed by:  FreeSTYLE Software Ltd.
// Author:        Rezo Mesarkishvili
// Last revision: 17 December 2003
//------------------------------------------------------------------------------

//-------------------------------------------------------------/ HelpItem /-----
function HoverIn ()
{
   var HoverItem = window.event.srcElement;
   if ( HoverItem.Status != null )
   {
      BorderColours [ HoverItem.name ] = document.all ( HoverItem.name ).currentStyle.borderColor;
      document.all ( HoverItem.name ).style.borderColor = ActiveInpBorder;
      g_Footer.ShowStatus ( HoverItem.Status );
      if ( window.document.all ( "Prompt" + HoverItem.Status ))
      {
         window.document.all.InfoImg.style.display = "block";
         window.document.all ( "Prompt" + HoverItem.Status ).style.display = "block";
      }
      return;
   }
   if ( HoverItem.Info != null )
   {
      window.document.all.InfoImg.style.display = "block";
      window.document.all ( "Prompt" + HoverItem.Info ).style.display = "block";
   }
   if (    HoverItem.Help != null
        && HoverItem.currentStyle.cursor != "hand"
      )
   {
      HoverItem.style.cursor = "help";
      if ( HoverItem.Prop != null )
      {
         g_Footer.ShowPropStatus ( HoverItem.Prop, 56 );
         return;
      }
      g_Footer.ShowStatus ( 56 );
   }
   else
   if (    HoverItem.parentElement
        && HoverItem.parentElement.Help != null
      )
   {
      HoverItem.style.cursor = "help";
      if ( HoverItem.parentElement.Prop != null )
      {
         g_Footer.ShowPropStatus ( HoverItem.parentElement.Prop, 56 );
         return;
      }
      g_Footer.ShowStatus ( 56 );
   }
   if ( HoverItem.Prop != null )
   {
      g_Footer.ShowPropStatus ( HoverItem.Prop );
   }
   if ( HoverItem.Tab != null )
   {
      HoverItem.style.color = "rgb(70,136,136)";
      HoverItem.style.cursor = "hand";
   }
}

//-------------------------------------------------------------/ HoverOut /-----
function HoverOut ()
{
   var HoverItem = window.event.srcElement;

   if ( HoverItem.Status != null )
   {
      if (    window.event.fromElement.tagName == "SELECT"
           && ! window.event.toElement
         )
      {
         return;
      }

      document.all ( HoverItem.name ).style.borderColor = BorderColours [ HoverItem.name ] ? BorderColours [ HoverItem.name ] : InactiveInpBorder;
      if ( document.all ( HoverItem.name ).style.borderColor == SelectedInpBorder )
      {
         document.all ( HoverItem.name ).style.borderColor = InactiveInpBorder;
      }
      g_Footer.HideStatus ();
      if ( window.document.all ( "Prompt" + HoverItem.Status ))
      {
         window.document.all.InfoImg.style.display = "none";
         window.document.all ( "Prompt" + HoverItem.Status ).style.display = "none";
      }
      return;
   }

   if (    HoverItem.Help != null
        || (    HoverItem.parentElement
             && HoverItem.parentElement.Help != null
           )
      )
   {
      g_Footer.HideStatus ();
   }
   if ( HoverItem.Prop != null )
   {
      g_Footer.HideStatus ();
   }
   if ( HoverItem.Info != null )
   {
      window.document.all.InfoImg.style.display = "none";
      window.document.all ( "Prompt" + HoverItem.Info ).style.display = "none";
   }
   if ( HoverItem.Tab )
   {
      HoverItem.style.color = "rgb(0,0,0)";
      HoverItem.style.cursor = "default";
   }
}

//----------------------------------------------------------/ ContextHelp /-----
function HoverClick ()
{
   var HoverItem = window.event.srcElement;

   if (    HoverItem.Help != null
        || (    HoverItem.parentElement
             && HoverItem.parentElement.Help != null
           )
      )
   {
      var Help = "" + ( HoverItem.Help != null ? HoverItem.Help : HoverItem.parentElement.Help );
      var HelpURL = "../_Help/" + Help.substr ( 0, 1 ) + "H.htm";
      if ( Help.length > 1 )
      {
         HelpURL += "#_" + Help;
      }
      if (    g_Main.HelpWin
           && ! g_Main.HelpWin.closed
         )
      {
         g_Main.HelpWin.navigate ( HelpURL );
         g_Main.HelpWin.focus ();
      }
      else
      {
         var Features = "fullscreen=0,channelmode=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,top=0,left=0,width=";
         Features += ( window.screen.availWidth *  0.6  ) + ",height=";
         Features += ( window.screen.availHeight * 0.75 );
         g_Main.HelpWin = window.open ( HelpURL, "", Features );
      }
      window.event.returnValue = false;
   }
   else
   if ( HoverItem.Tab != null )
   {
      g_Header.OpenTab ( HoverItem.Tab, HoverItem.Control );
   }
}

//____________________________________________________________ End of File _____
