// javascript file AC2008.js
//
//   Version   Date         Author   Desctiption
//    1.0      08/09/2008   ddsp     Start with routines from ddsp's toolbox
//    1.1      08/19/2008   ddsp     Add isNumeric 

    function setActiveClass(baseName, activeElement, classActive, classInactive)
    {
      var mIndex = 0;
      var mName = baseName + mIndex;
      //  Allow the list of menu elements to start at either 0 or 1
      if (document.getElementById(mName) == null) {mIndex = 1;}
      var mObject
      do
	  {
         mName = baseName + mIndex;
         mObject = document.getElementById(mName);
         if (mObject != null)
         {
            mObject.className = (mIndex == activeElement) ? classActive : classInactive;
            mIndex = mIndex + 1
         }
      } while (mObject != null);
    }
    
    function setMainMenu(thisMenuNumber)
    {
    	  setActiveClass("menu", thisMenuNumber, "menuActiveCell", "menuInactiveCell");
    	  setActiveClass("menuItem", thisMenuNumber, "menuActive", "menuInactive");
    }
    function showOpt(thisOpt)
    {
    	  setActiveClass("opt", thisOpt, "infoTextShow", "infoTextHide");
    }
    
    function reloadURL(extraSettings)
    {
      if (extraSettings == null) { extraSettings = ""; }
      document.location.href = window.location.pathname+extraSettings;
    }
    
    /** Onclick function to open new window
     */
    function newWindow(thisURL)
    {
      var newWin = window.open(thisURL,"newWindow",
         "toolbar=0,location=0,status=0,menubar=0,scrollbars=1",0);
		  if (window.focus) { newWin.focus(); }
    }

    /** Dummy function to make href look good
     */
    function doLink(thisText)
    {
    }
    
    /** Function to test for numeric
     *    My favorite of the IsNumeric functions
     *    http://www.techfeed.net/blog/index.cfm/2006/2/23/JavaScript-isNumeric-function
     */
    function isNumeric(n)
    {
       if(n*1==NaN)return false;else return true;
    }     