function add_dr() {
		var field_area = document.getElementById("dr_list");
		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'.
		 var last_item = all_inputs.length - 1;
		 var last = '';
		 var count = 0;
		 if (last_item < 1) {
		 		count = 1;
		 	} else {
		 		last = all_inputs[last_item].id;
		 		count = Number(last.split("_")[1]) + 1;
			}		
	
		
		
		var tr = document.createElement("tr");
		
		var td = document.createElement("td");
		var input = document.createElement("input");
		var input = document.createElement("input");
		  input.id = "fname_"+count;
		  input.name = "fname_"+count;
		  input.size = "11";
		  input.type = "text"; //Type of field - can be any valid input type like text,file,checkbox etc.
		  td.appendChild(input);
		  tr.appendChild(td);
		  
		  td = document.createElement("td");
		 	input = document.createElement("input");  
		  input.id = "lname_"+count;
		  input.name = "lname_"+count;
		  input.size = "11";
		  input.type = "text"; //Type of field - can be any valid input type like text,file,checkbox etc.
		  td.appendChild(input);
		   tr.appendChild(td);
		
		td = document.createElement("td");
		input = document.createElement("input");
		  input.id = "desig_"+count;
		  input.name = "desig_"+count;
		  input.size = "5";
		  input.type = "text"; //Type of field - can be any valid input type like text,file,checkbox etc.
		  td.appendChild(input);
			tr.appendChild(td);  
			
			td = document.createElement("td");
		input = document.createElement("input");
		  input.id = "email_"+count;
		  input.name = "email_"+count;
		  input.size = "11";
		  input.type = "text"; //Type of field - can be any valid input type like text,file,checkbox etc.
		  td.appendChild(input);
			tr.appendChild(td);  
		  
		  td = document.createElement("td");
		  button = document.createElement("input");
		  button.id = "button_"+count;
		  button.name = "button_"+count;
		  button.type = "button";
		  button.value = "Del";
		  button.setAttribute("onclick", "javascript:remove_row(this);");
		  td.appendChild(button);
		  tr.appendChild(td);
		  field_area.appendChild(tr);

}

function add_contact() {
		var field_area = document.getElementById("contact_list");
		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'.
		 var last_item = all_inputs.length - 1;
		 var last = '';
		 var count = 0;
		 if (last_item < 1) {
		 		count = 1;
		 	} else {
		 		last = all_inputs[last_item].id;
		 		count = Number(last.split("_")[1]) + 1;
			}		
		
		
		var tr = document.createElement("tr");
		
		var td = document.createElement("td");
		var input = document.createElement("input");
		var input = document.createElement("input");
		  input.id = "cfname_"+count;
		  input.name = "cfname_"+count;
		  input.size = "18";
		  input.type = "text"; //Type of field - can be any valid input type like text,file,checkbox etc.
		  td.appendChild(input);
		  tr.appendChild(td);
		  
		  td = document.createElement("td");
		 	input = document.createElement("input");  
		  input.id = "clname_"+count;
		  input.name = "clname_"+count;
		  input.size = "18";
		  input.type = "text"; //Type of field - can be any valid input type like text,file,checkbox etc.
		  td.appendChild(input);
		   tr.appendChild(td);
		
		td = document.createElement("td");
		input = document.createElement("input");
		  input.id = "cemail_"+count;
		  input.name = "cemail_"+count;
		  input.size = "15";
		  input.type = "text"; //Type of field - can be any valid input type like text,file,checkbox etc.
		  td.appendChild(input);
			tr.appendChild(td);  
		  
		  td = document.createElement("td");
		  button = document.createElement("input");
		  button.id = "cbutton_"+count;
		  button.name = "cbutton_"+count;
		  button.type = "button";
		  button.value = "Del";
		  button.setAttribute("onclick", "javascript:remove_row(this);");
		  td.appendChild(button);
		  tr.appendChild(td);
		  field_area.appendChild(tr);

}



function remove_row(button) {
	/*button = document.getElementById("button_" + row)*/
	var this_child = button.name;
	var count = Number(this_child.split("_")[1]);
	var td = button.parentNode;
	var tr = td.parentNode;
	var tbody = tr.parentNode;
	tbody.removeChild(tr); 
	
}