    //
    //    term_create
    //
    //    This provides a method for creating a term to be used in an equation.
    //
    //    This routine create a term that may be either constant or variable.  This
    //    will generate the term type randomly.
    //
    function term_create() {
       var  n = random() ;
       var  x = random() ;
       
       while (n == 0) n = random() ;
       
       if (x % 2 == 0) {
           str = n + "x" ;
       } else {
           str = n
       }
       return str ;
    }
    
    //
    //    variable_term_create
    //
    //    This provides a method for creating a term to be used in an equation.
    //
    //    This routine only creates variable terms.
    //
    function variable_term_create() {
       var  n = random() ;
       
       while (n == 0 ) n = random() ;
       
       return (n + "x") ;
    }
    
    
    //
    //    operator_create
    //
    //    This provides a method for creating an operator to be used in an equation.
    //
    //    This routine creates either an "+" or "-" operator.
    //
    function operator_create() {
        var x = random() ;
        str = ((x % 2 == 0) ? " + " : " - ") ;
        return str ;
    }
    
    //
    //    constant_create
    //
    //    This provides a method for creating a constant for use in an equation.
    //
    function constant_create() {
        var n = random() ;
        
        while (n == 0) n = random() ;
        
        return (n) ;
    }
    
    //
    //    coefficient_extract
    //
    //    This provides a method for identifying a coefficient in a term.
    //
    function coefficient_extract(str) {
        var re                    ;
        var x                     ;
           
        re = /([-0-9]*)x/         ;
        x = str.match(re)         ;
	char = (x == 0) ? "" : RegExp.$1 ;
        return(char)         ; 
    }
    
    //
    //    variable_expression
    //
    //    This provides a method for identifying variable expressions.
    //
    function variable_expression(str) {
        var re = /x/ ;
        return (re.test(str)) ;
    }
    
    
    //
    //    numeric_expression
    //
    //    This provides a method for identifying if a term is a numeric
    //    expression.
    //
    function numeric_expression(str) {
        var re                     ;
        var tmp                    ;
        re = /([-]{0,1}[0-9]+)/    ;
        str = new String(str)      ;
        tmp = str.match(re)        ;

        return ( RegExp.$1 == str) ;
    }
    
    //
    //    operator
    //    
    //    This provides a method for identifying if a string is either 
    //    a " + " or " - ".
    //
    function operator(str) {
        return ( ((str == " + ") || (str == " - ")) ? true : false) ;
    }

