/******************************************************************************
* TopClass Enterprise Server version: 7.2.0 for Windows NT and Solaris
*
* Copyright WBT Systems, 1999-2004 All rights reserved world wide
*
* This file contains the JavaScript functions that are used by the multiple fill
* in the blanks question to validate the user input as numeric. Modification to 
* this file is at the users own risk.
*
* Queries to <support@wbtsystems.com>
*
******************************************************************************/
/******************************************************************************

  File: chknumbers.js
  Author: pmaher
  Copyright WBT Systems, 1999-2004
  Contents:
  Version: 7.2.0
  Build: 101

******************************************************************************/
/*
   Date:          Author:  Comments:
   29th Jun 2004  pmaher   Original

*/

function checkValue(obj)
{
  hide = document.getElementsByName(obj.name + "_hidden")[0];
  if (!isNumeric(obj.value))
  {
    if (hide)
    {
      obj.value = hide.value;
      return false;
    }
  }
  else
  {
    value = obj.value;
    elems = value.split(".");
    if (elems.length > 1)
    {
      if ((elems.length > 3) || (elems[1].length > 2))
      {
        alert("too many decimal places");
        if (hide)
        {
          obj.value = hide.value;
          return false;
        }
      }
    }
    hide.value = obj.value;

  }
}

function isNumeric( numericValue )
{
  var re = new RegExp (',', 'gi') ;
  var myNumber = numericValue.replace(re, '.') ;

  if( isNaN(myNumber ) )
  {
    return false;
  }
  
  return true;
}