//Add more fields dynamically.
function addField(area) {

 if(!document.getElementById) return; //Prevent older browsers from getting any further.

 var field_area = document.getElementById(area);
 var all_inputs = field_area.getElementsByTagName("input"); //Get all the input fields in the given area.
 //Find the count of the last element of the list. It will be in the format '<field><number>'. If the 
 //  field given in the argument is 'friend_' the last id will be 'friend_4'.
   
 if(document.createElement) { //W3C Dom method.
  var li = document.createElement("li");
  
	  //create caption field
  var input = document.createElement("input");
  input.name ="date[]";
  input.size = "13";
  input.type = "text"; //Type of field - can be any valid input type like text,file,checkbox etc.
  li.appendChild(input);
  
    //create input field
  var input1 = document.createElement("input");
  input1.name ="day[]";
  input1.size = "13";
  input1.type = "text"; //Type of field 
  li.appendChild(input1);
      //create input field
  var input2 = document.createElement("input");
  input2.name ="grade[]";
  input2.size = "13";
  input2.type = "text"; //Type of field 
  li.appendChild(input2);
      //create input field
  var input3 = document.createElement("input");
  input3.name ="ward[]";
  input3.size = "13";
  input3.type = "text"; //Type of field 
  li.appendChild(input3);
      //create input field
  var input4 = document.createElement("input");
  input4.name ="start_time[]";
  input4.size = "13";
  input4.type = "text"; //Type of field 
  li.appendChild(input4);
  
        //create input field
  var input5 = document.createElement("input");
  input5.name ="finish_time[]";
  input5.size = "13";
  input5.type = "text"; //Type of field 
  li.appendChild(input5);
  
          //create input field
  var input6 = document.createElement("input");
  input6.name ="job_ref[]";
  input6.size = "13";
  input6.type = "text"; //Type of field 
  li.appendChild(input6);
  
          //create input field
  var input7 = document.createElement("input");
  input7.name ="other_info[]";
  input7.size = "13";
  input7.type = "text"; //Type of field 
  li.appendChild(input7);
  
  field_area.appendChild(li);
 } else { //Older Method
 
  //field_area.innerHTML += "<li><input name='cap_"+(count)+"' id='cap_"+(count)+"' type='text' /></li>";
 }
}