var counter = 1;
var limit = 10;
function addInput(divName){
     if (counter == limit)  {
          alert("You have reached the limit of adding " + counter + " inputs");
     }
     else {
          var newdiv = document.createElement('div');
          newdiv.innerHTML = " <table><tr><td><input type='text' name='field_21[]' onfocus=\"this.value=''\" class=\"input2\"></td><td> <input type='text' name='field_22[]' onfocus=\"this.value=''\" class=\"input2\"></td><td> <input type='text' name='field_23[]' onfocus=\"this.value=''\" class=\"input2\"></td><td> <input type='text' name='field_24[]' onfocus=\"this.value=''\" class=\"input2\"></td><td> <input type='text' name='field_25[]' onfocus=\"this.value=''\" class=\"input2\"></td></tr></table>";
          document.getElementById(divName).appendChild(newdiv);
          counter++;
     }
}
