  //****************************************************************--
  // Utility functions for added WebSpeed functionality             --
  // Created By   : Chris Larson                                    --
  // Created On   : 5-28-00                                         --
  //                                                                --
  // Last Updated : v1.0  5-28-00                                   --
  // 05-28-00     : Created utilities.js and added captureEvent()   --
  // 05-30-00     : Added openList function                         --
  // 12.17.00     : Copied file to Epicor/JavaScript                --
  // 09/04/03 SEV scr3759 Added floatRangeCheck() and intRangeCheck --
  //****************************************************************--


  //------------------------------------------------------------------
  // captureEvent() : Created to capture events triggered by users. --
  //                  This function can also display a confirm      --
  //                  message.                                      --
  // Required Field : <input name="event" type="hidden" value="">   --
  // Required Field : <input name="vchange" type="hidden" value=""> --
  //------------------------------------------------------------------
  function captureEvent(eventName,promptMsg) {
    if(promptMsg == "" || promptMsg == " ") {
      document.forms[0].event.value = eventName;
      return true;
    } else {
      if(document.forms[0].vchange.value == "yes") {

        if(confirm(promptMsg)) {
          document.forms[0].event.value = eventName;
          return true;
        } else {
          return false;
        }

      } else {
        document.forms[0].event.value = eventName;
        return true;
      }
    }
  }

  //------------------------------------------------------------------
  // valueChange() : Created to capture events triggered by users.  --
  //                 This function can also display a confirm       --
  //                 message.                                       --
  // Required Field : <input name="vchange" type="hidden" value=""> --
  //------------------------------------------------------------------
  function valueChange() {
    document.forms[0].vchange.value = "yes";
  }

  //------------------------------------------------------------------
  // Function	: stsDisp()                                         --
  // Purpose  : Message to be displayed in status.                  --
  //------------------------------------------------------------------
  function stsDisp(msg) {
    window.status = msg;
    return true;
  }

  //------------------------------------------------------------------
  // Function	: findRec()                                         --
  // Purpose  : Opens up the Search dialog Box.                     --
  //------------------------------------------------------------------
  function findRec(pDBName, pSelectClause) {
    findWin = window.open("sys-search.htm?database_name=" + escape(pDBName) + "&table_name=" + escape(pSelectClause), "findwin", "toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=700,height=275,top=300,left=300");
    findWin.focus();
    return false;
  }

  //------------------------------------------------------------------
  // Function : floatRangeCheck()                                   --
  // Purpose  : if the given field's value is not a decimal, or     --
  //            not in the given range, it sends an alert() and     --
  //            returns false                                       --
  //------------------------------------------------------------------
  function floatRangeCheck( fld, minNum, maxNum) {
    //remove commas
    var re = /,/g
    var cNum = fld.value.replace( re , "");
    if ( isNaN( parseFloat( cNum ) ) ) {
      alert( "Invalid Amount." );
      return false;
    } else if ( parseFloat( cNum ) < parseFloat(minNum) ) {
      alert( "Value must not be less than " + minNum + "." );
      return false;
    } else if ( parseFloat( cNum ) > parseFloat(maxNum) ) {
      alert( "Value must not exceed " + maxNum + "." );
      return false;
    }
    return true;
  }
  //------------------------------------------------------------------
  // Function	: getArgs()                                         --
  // Purpose  : Parse the URL parameters                            --
  //------------------------------------------------------------------
  function getArgs( argName ) {
    var params = "&" + location.search.substring(1);

	//Find the parameter
    var pos = params.indexOf( '&' + argName + '=' );
    if ( pos == -1 ) return '';
	var value = params.substring( pos + argName.length + 2 );


	//Stript off the rest of the string
	pos = value.indexOf( '&' );
    if ( pos > -1 ) value = value.substring( 0, pos );
	
	return unescape( value );
  }

  //------------------------------------------------------------------
  // Function : intRangeCheck()                                     --
  // Purpose  : if the given field's value is not an integer, or    --
  //            not in the given range, it sends an alert() and     --
  //            returns false                                       --
  //------------------------------------------------------------------
  function intRangeCheck( fld, minNum, maxNum) {
    //remove commas
    var re = /,/g
    var cNum = fld.value.replace( re , "");
    if ( isNaN( parseInt( cNum ) ) ) {
      alert( "Invalid Amount." );
      return false;
    } else if ( parseInt( cNum ) < parseInt(minNum) ) {
      alert( "Value must not be less than " + minNum + "." );
      return false;
    } else if ( parseInt( cNum ) > parseInt(maxNum) ) {
      alert( "Value must not exceed " + maxNum + "." );
      return false;
    }
    return true;
  }

