// **************************************************************************
// *  Rincon Ridge Guitars, LLC.
// *  © Copyright 2009-2012 Rincon Ridge Guitars, LLC.
// *  Precautionary notice only -- No publication intended
// *
// *  ALL RIGHTS RESERVED
// *
// *  Any copying, use, disclosure, modification, or transfer
// *  by rental, sale, or otherwise without the written consent
// *  of Rincon Ridge Guitars, LLC is strictly prohibited.
// **************************************************************************

var statusmsg=""

//===========================================================================
function overlay(RequestedDiv)
{
   // This function will display a dialog box on top of the CSS form.
   el = document.getElementById(RequestedDiv);
   el.style.visibility = (el.style.visibility == "visible") ? "hidden" : "visible";
}

//===========================================================================
function getAbsoluteDivs()
{
   var arr = new Array();
   var all_divs = document.body.getElementsByTagName( "DIV" );
   var j = 0;

   for( i = 0; i < all_divs.length; i++ )
   {
      if( all_divs.item(i).currentStyle )
         style = all_divs.item(i).currentStyle.position;
      else
         style = window.getComputedStyle( all_divs.item(i), null).position;

      if( 'absolute' == style )
      {
         arr[j] = all_divs.item(i);
         j++;
      }
   }
   return arr;
}

//===========================================================================
function bringToFront(id)
{
   if( !document.getElementById || !document.getElementsByTagName )
      return false;

   var obj = document.getElementById(id);
   var divs = getAbsoluteDivs();
   var max_index = 0;
   var cur_index;

   // Compute the maximal z-index of other absolute-positioned divs
   for( i = 0; i < divs.length; i++ )
   {
      var item = divs[i];
      if( item == obj || item.style.zIndex == '')
         continue;

      cur_index = parseInt(item.style.zIndex);
      if( max_index < cur_index )
      {
         max_index = cur_index;
         item.style.visibility = "hidden";
      }
   }

   obj.style.zIndex = max_index + 1;
   obj.style.visibility = "visible";
   return false;
}

//===========================================================================
function hidestatus()
{
   window.status=statusmsg
   return true
}
