function Pos(Substr, S)
	
{
		return S.indexOf(Substr) + 1
	
}




function Length(S)
	
{
		return S.length

	}




function Copy(S, Index, Count)

	{
		return S.substring(Index - 1, Count + 1)

	}




function Delete(S, Index, Count)
	
{
		return S.substring(0, Index) + S.substring(Index + Count, S.length)

	}




function RemoveAllSpaces(aStr)
	
{
		var FStr

		var i
		FStr = aStr


		i = 0

		while (i < FStr.length)

		{
			//(i < FStr.length)

		  
      if (FStr.charAt(i) == ' ')

				{

				        FStr = Delete(FStr, i, 1)
				}
				else{
				
        i = i + 1

				}
		}
			//(i < FStr.length)

			return FStr
	}




function HasNonDigitChar(aStr)

	{
		var i;
		for (i = 0; i < aStr.length; i++)

		{
			//for i
			if(!( (aStr.charAt(i) >= '0') && (aStr.charAt(i) <= '9') )
)
				return true

      
    	} //for i
		return false

	}




function ValidDecimalNumber(aStr)
	
{
		var i
  var FDPC;
		FDPC = 0;
 

		for (i = 0; i < aStr.length; i++)

		{ //for i


		      if(!( (aStr.charAt(i) >= '0') && (aStr.charAt(i) <= '9') )
 )
			{ //! 0 to 9.

			if (aStr.charAt(i) == '.')

			{ //decimal point
				//    //A decimal point has been encountered, this is a 
		      //second one -- invalid.
		      //
		      if (FDPC == 1)  
		        return false;
		      //
		      //This is the first one.
		      //
		      else
		        FDPC = 1;
		    } //decimal point
		  else 
		  //
		  //Invalid.
		  //
		    return false;
		   
		} //! 0 to 9. 

    } //for i

  return true;
}

function FormatDecimal(aDcmStr, aDPoint)
{
  var FDecCmps; 
  var FInt;
  var FDecPart;
  
  
  //
  //Splits the string into the integral and decimal portion.
  //
  FDecCmps = aDcmStr.split(".");
  
  //
  //If there is decimal portion, set this to FDecPart. Otherwise, set FDecPart to blank.
  //
  if (FDecCmps.length > 1)  
    FDecPart = FDecCmps[1];
  else
    FDecPart = "";
    
  //
  //The total number of digits in the decimal part.
  //
  FInt = FDecPart.length;

  //
  //If there are more decimal places than required, discarded the extras.
  //
  if (FInt > aDPoint)
    FDecPart = FDecPart.substr(0, aDPoint)
  //
  //Otherwise, appends 0s to the end.
  //
  

			else if (FInt < aDPoint)
    {
      FInt = FInt + 1;
      for (; FInt <= aDPoint; FInt++)
        FDecPart = FDecPart + "0";
    }

  //
  //Finally, returns the correctly formatted number.
  //  
  return FDecCmps[0] + "." + FDecPart;
}
