/*
*   LIB.JS
*   - Central repository for any dashboard-wide .js functions.
*
*   Created: 08/04/2008
*   Changed: 09/13/2009
*
*   Property Of: Dns Inc.
*   Copyright DnS Inc., All Rights Reserved
*/

function autoRefresh(loc,FormName,InputName) {
  var idx = document.forms[FormName].elements[InputName].selectedIndex;
  var value = document.forms[FormName].elements[InputName].options[idx].value;
  window.location.href = loc + value;
}

/* functions for progress_timer */

/******************************************************************************************
   this fn adds as many onload events as you want to the onload event.
   - you can just name the function to run or build your own on the fly.
   - nice script. see here for reference: http://simonwillison.net/2004/May/26/addLoadEvent/

   IMPLEMENTATION:

   //-- progress timer
   if($loggingIn || $loggingOut) {
     //-- look in lib.js for documentation on this.
     $header .= "
   <script type='text/javascript'>
     addLoadEvent(progress_timer);
   </script>";
   }

*/

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
    func();
    }
  }
}

/**************************************************
  these two work together
*/

function toggleDisplayBlock(idOf) {
  var element = document.getElementById(idOf);
  if (element != undefined)
  {
    if (element.style.display == 'none') {
      element.style.display = 'block';
    }else{
      element.style.display = 'none';
    }
  }
}

function progress_timer() {
  toggleDisplayBlock('progress_timer');
  return true;
}

