function moreForward(e)
{
e.preventDefault();
last = $('div.vmail-forward:last');
last_id = parseInt(last.attr('id').match(/\d+/g));
new_id = ++last_id;
if (new_id > 50) {
alert("Jetzt wird's merkwürdig. Bitte nutzen Sie eine Mailingliste wenn Sie so viele Empfänger brauchen!");
return;
}
var $clone = last.clone();
$clone.attr('id',$clone.attr('id').replace(/\d+$/, function(str) { return parseInt(str) + 1; }) );
// Find all elements in $clone that have an ID, and iterate using each()
$clone.find('[id]').each(function() {
//Perform the same replace as above
var $th = $(this);
var newID = $th.attr('id').replace(/\d+$/, function(str) { return parseInt(str) + 1; });
$th.attr('id', newID);
});
// Find all elements in $clone that have a name, and iterate using each()
$clone.find('[name]').each(function() {
//Perform the same replace as above
var $th = $(this);
var newName = $th.attr('name').replace(/\d+$/, function(str) { return parseInt(str) + 1; });
$th.attr('name', newName);
});
$clone.find('input:first-of-type').val('');
$clone.find('select:first-of-type')
.find('option:first-of-type').prop('selected', true);
$clone.find('.warning').text('');
$clone.find('.warning').hide();
$clone.find('div.delete_forward').click(removeForward);
$clone.find('input').on("change keyup paste", checkForward);
last.after($clone);
}
function removeForward()
{
div = $(this).closest('div.vmail-forward');
input = div.find('input:first');
input.val('');
select = div.find('select:first');
select.find('option:first').prop('selected', true);
if ($('div.vmail-forward').length > 1) {