function cloning(from, to, counter) {
	var clone = $(from).clone();

	// Replace the input attributes:
	clone.find(':input').each(function() {
		var name = $(this).attr('name').replace('template', counter);
		var id = $(this).attr('id').replace('template', counter);
		$(this).attr({
			'name' : name,
			'id' : id,
		});
	});

	// Replace the label for attribute:
	clone.find('label').each(function() {
		var newFor = $(this).attr('for').replace('template', counter);
		$(this).attr('for', newFor);
	});

	// Replace the text between html tags:
	clone = clone.html().replace('template', counter);
	$(to).append(clone);
	
	counter++;	
	return counter;
} // end cloning
