
 function strltrim() {
   return this.replace(/^\s+/,'');
 }

 function strrtrim() {
   return this.replace(/\s+$/,'');
 }

 function strtrim() {
   return this.replace(/^\s+/,'').replace(/\s+$/,'');
 }

 String.prototype.ltrim = strltrim;
 String.prototype.rtrim = strrtrim;
 String.prototype.trim = strtrim;



  // ---------------------
  // -- Image Preloader --
  // ---------------------
  
  /*
  var aImgSrc = new Array();
  aImgSrc[0] = '/images/menu/menu_arrow_down_down.jpg';
  aImgSrc[1] = '/images/menu/menu_arrow_down_up.jpg';
  aImgSrc[2] = '/images/menu/menu_arrow_up_down.jpg';
  aImgSrc[3] = '/images/menu/menu_arrow_up_up.jpg';
  aImgSrc[4] = '/images/top_button_off.jpg';
  aImgSrc[5] = '/images/top_button_on.jpg';


  var aImgs = new Array();
  for (i=0; i<aImgSrc.length; i++) {
    aImgs[i] = new Image();
    aImgs[i].src = aImgSrc[i];
  }

*/

  // --------------------------------------
  // -- Menu Roll-Over and Press Effects --
  // --------------------------------------

  function menuRollOn(oMenu) {
    oMenu.className = 'menuhdov';
  }
 
  function menuRollOff(oMenu) {
    oMenu.className = 'menuhd';
  }


  function menuPressed(oMenu) {
    if (isDOMCompliant) {
/*      var oButton = document.getElementById(oMenu.id + '_but'); */
      var oCont = document.getElementById(oMenu.id + '_content');

/*      if (oCont.style.display == 'none') {
        oButton.className = 'menubtdd';
      }
      else {
        oButton.className = 'menubtud';
      }
*/
    }  
  }
 

  function menuUnPressed(oMenu) {
    if (isDOMCompliant) {
/*      var oButton = document.getElementById(oMenu.id + '_but'); */
      
      var oCont = document.getElementById(oMenu.id + '_content');

      if (oCont.style.display == 'none') {

        // Change visibility of the menu contents //
        oCont.style.display = '';
/*        oButton.className = 'menubtuu'; */

        // Set Cookie representing this menu's state //
        document.cookie = oMenu.id + '=1;expires=' + getCookieExpireDate(365)+ ';path=/';
      }
      else {
        oCont.style.display = 'none';
/*        oButton.className = 'menubtdu'; */
        document.cookie = oMenu.id + '=0;expires=' + getCookieExpireDate(365) + ';path=/';
      }
 
    }
  
  }            

  

  // --------------------------------------- 
  // -- Menu State Preservation Functions --
  // ---------------------------------------


  function loadMenuVis()
  {
    //alert('Loading Menu State');


    var aCookies;
    var aCookie;
    var sCookieName;
    var sCookieValue;
    var oButton;
    var oContent;

    if ( isDOMCompliant() ) {

      // Break Down Cookies //

      aCookies = document.cookie.split(';');

      for (i=0; i<aCookies.length; i++ ) {
        aCookie = aCookies[i].split('=');
        sCookieName = aCookie[0].trim();

        // Is it a Menu Cookie? //

        if (sCookieName.indexOf('menu-') != -1) {
          oContent = document.getElementById(sCookieName + '_content');
          if (oContent) {	// Does the menu actually exist in the document??
            if (aCookie[1] == '0') {
              oContent.style.display = 'none';
            }
            else {
              oContent.style.display = '';
            }
          }
          
        }


      }
    }

  }


  function saveMenuVis() {
/*
    var oTables;
    var sTableId;

    if ( isDOMCompliant() ) {

      oTables = document.getElementsByTagName('TR');

      for (i=0; i<oTables.length; i++) {

        sTableId = oTables[i].id;      

        if (sTableId.indexOf('menu-') == 0 && sTableId.indexOf('_') == -1 ) {

          if (document.getElementById(sTableId + '_content').style.display == 'none') {
            document.cookie = sTableId + '=0;expires=' + getCookieExpireDate(1) + ';path=/';
          }
          else {
            document.cookie = sTableId + '=1;expires=' + getCookieExpireDate(1) + ';path=/';
          }

        }

      }
    }
*/
  }


  function getCookieExpireDate(noDays) {
    var today = new Date();
    var expr = new Date(today.getTime() + noDays*24*60*60*1000);
    return  expr.toGMTString();
  }





  // ------------------------------------------------
  // -- Browser Identification/Capability Checkers --
  // ------------------------------------------------

  function isIE()
  {
    var sAgent = navigator.userAgent.toLowerCase();
    if (sAgent.indexOf('msie') != -1)
    {
      return true;
    }
    else
    {
      return false;
    }
  }


 // isDynamic()
 //
 // Returns True if a current browser platform is found,
 // namely Netscape 6.0 (displays as app version 5), or
 // Internet Explorer 5
 
 function isDynamic() {
   var appVer = navigator.appVersion.toLowerCase();
   var appName = navigator.appName.toLowerCase();
   var isCompatible;

   isCompatible = false;

   if ( appName == 'netscape' ) {

     if ( parseFloat(appVer) >= 5.0 ) {
       isCompatible = true;
     }
     
   }
   else if ( appName == 'microsoft internet explorer' ) {

     if ( parseFloat(appVer.split('msie')[1]) >= 5.0 ) {
       isCompatible = true;
     }
   }
   
   return isCompatible;
 }
 


 function isDOMCompliant() {
   return document.getElementById;
 }


