listen


          var started = false;        
  
          function listen(User){
                    sInput = User;
             if(started){ clearTimeout(Rtimer); }
                  Rtimer = setTimeout("wakeup()", 180000);                // wake up call
                  started = true;                                                                                // needed for Rtimer
             sInput = strTrim(sInput);                                                        // dress input formating
                  if( sInput != "" ){ 
                          wInput = padString(sInput.toUpperCase());        // Work copy
                          var foundkey = maxKey;                                           // assume it's a repeat input
                          if (wInput != wPrevious){                                           // check if user repeats himself
                                  foundkey = findkey(wInput);                           // look for a keyword.
                          }
                          if( foundkey == keyNotFound ){
                                  if( !greet ){ greet = true; return "Don't you ever say Hello?" } 
                                  else {
                                          wPrevious = wInput;                                  // save input to check repeats
                                          if(( sInput.length < 10 ) && ( wTopic != "" ) && ( wTopic != wPrevious )){
                                                  lTopic = conjugate( sTopic ); sTopic = ""; wTopic = "";
                                                  return 'OK... "' + lTopic + '". Tell me more.';
                                          } else {
                                                  if( sInput.length < 15 ){ 
                                                          return "Tell me more..."; 
                                                  } else { return phrase( sInput, foundkey ); }
                                          }
                                  }
                          } else { 
                                  if( sInput.length > 12 ){ sTopic = sInput; wTopic = wInput; }
                                  greet = true; wPrevious = wInput;                          // save input to check repeats
                                  return phrase( sInput, foundkey );                        // Get our response
                          }
                  } else { return "I can't help, if you will not chat with me!"; }
          }