Javascript action help

<script type="text/javascript">
        function showHint1(str) {

            if (str.length == 0) {
                document.getElementById("txtHint1").innerHTML = "";
            if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp = new XMLHttpRequest();
            else {// code for IE6, IE5
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            xmlhttp.onreadystatechange = function() {
                if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                    document.getElementById("txtHint1").innerHTML = 'Name: ' +  xmlhttp.responseText;
  "GET", "action.php?q=" + str, true);


i see this function which u using for send data on action form when user enter any thing in input field
like using these attributes

<input type="text" id="user" onkeyup="javascript:showHint1(this.value)" />

i want that i can limit words when user reach on the limit of words the data sent to Action Form not send before that
this fucntion start sending data even when user enter 1 word in input

how to apply condition of words or time elay :shifty: